惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
TaoSecurity Blog
TaoSecurity Blog
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题
T
Troy Hunt's Blog
N
News and Events Feed by Topic
雷峰网
雷峰网
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 三生石上(FineUI控件)
Schneier on Security
Schneier on Security
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 最新话题
V
V2EX
T
Threat Research - Cisco Blogs
人人都是产品经理
人人都是产品经理
C
Cisco Blogs
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
I
Intezer
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
月光博客
月光博客
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News | PayPal Newsroom
Cyberwarzone
Cyberwarzone
B
Blog
博客园 - 聂微东
P
Palo Alto Networks Blog
A
About on SuperTechFans
The Last Watchdog
The Last Watchdog
Scott Helme
Scott Helme
Google DeepMind News
Google DeepMind News
Webroot Blog
Webroot Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
O
OpenAI News
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
A
Arctic Wolf

博客园 - sumh

用PowerShell批量删除未部署的wsp包 用PowerShell批量收回wsp包 用PowerShell批量部署wsp包 WSS3.0升级到Foundation 2010 PowerShell 操作bcs PowerShell搜索元数据 开发,部署,监视SharePoint 2010的沙盒解决方案 修改MOSS的RTF字段的上传图片功能 高权限的工作流 可重用声明性工作流 站点工作流 工作流事件 可插接式的工作流服务 sharepoint 2010 beta Workflow WF4的新功能 介绍WF4 用Aspx页面做流程表单的一些感想 创建网站集的内容类型 创建Infopath表单数据源的详细步骤图解
用Openxml获取本地文件的扩展信息
sumh · 2011-11-08 · via 博客园 - sumh
 

FileInfo类只能获取文件的基本信息,对于文件的详细信息无法获取,因此获取文件详细信息可以采用两种方式:

一是用shell32shellclass类获取;

二是用Openxml来获取。

第一种比较麻烦在vssharepoint空项目中无法载入,在webapplication里可以正常使用;如果想使用那么需要用dllload导入。

第二种采用openxmlopenxml只能操作office2007以上版本的文档,目前支持wordexcelppt三种。下面以word为例:

用WordprocessingDocument类来操作文档,具体的代码如下:

using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(url, true))

{

    CoreFilePropertiesPart corePart = wordDoc.CoreFilePropertiesPart;

  //获取本地文件的作者

    string creator = corePart.OpenXmlPackage.PackageProperties.Creator;

}