Fetching meta data of MS Office files [modified]
-
We are trying to fetch Author, Company Name and Creation Date of MS Office Files (.doc, .docx, .xls, .xlsx, .ppt, .pptx) using following code
protected void Page_Load(object sender, EventArgs e) { string strFileName = string.Empty; strFileName = @"D:\My File.pptx"; DSOFile.SummaryProperties DSOSummaryProperties; DSOFile.OleDocumentPropertiesClass OleFile; OleFile = new OleDocumentPropertiesClass(); OleFile.Open(strFileName, true, dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess); DSOSummaryProperties = OleFile.SummaryProperties; Response.Write("Author : " + DSOSummaryProperties.Author); Response.Write(" Company : " + DSOSummaryProperties.Company); Response.Write(" Date Created : " + DSOSummaryProperties.DateCreated); OleFile.Close(false); }
This works well in many conditions except stated below 1. If we try to rename .docx as .doc or .xlsx as .xls or .pptx as .ppt In this situation no data is fetched, but no error too 2. When file is created like, Right Click in any drive -> New -> New Microsoft Office Word Document.docx or New Microsoft Office Excel Worksheet.xlsx or New Microsoft Office PowerPoint Presentation.pptx In this case while opening the file following error is generated Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) Please guide, if any one knows the reason behind. More over how to fetch meta data of .xps files?modified on Thursday, April 17, 2008 4:06 AM
-
We are trying to fetch Author, Company Name and Creation Date of MS Office Files (.doc, .docx, .xls, .xlsx, .ppt, .pptx) using following code
protected void Page_Load(object sender, EventArgs e) { string strFileName = string.Empty; strFileName = @"D:\My File.pptx"; DSOFile.SummaryProperties DSOSummaryProperties; DSOFile.OleDocumentPropertiesClass OleFile; OleFile = new OleDocumentPropertiesClass(); OleFile.Open(strFileName, true, dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess); DSOSummaryProperties = OleFile.SummaryProperties; Response.Write("Author : " + DSOSummaryProperties.Author); Response.Write(" Company : " + DSOSummaryProperties.Company); Response.Write(" Date Created : " + DSOSummaryProperties.DateCreated); OleFile.Close(false); }
This works well in many conditions except stated below 1. If we try to rename .docx as .doc or .xlsx as .xls or .pptx as .ppt In this situation no data is fetched, but no error too 2. When file is created like, Right Click in any drive -> New -> New Microsoft Office Word Document.docx or New Microsoft Office Excel Worksheet.xlsx or New Microsoft Office PowerPoint Presentation.pptx In this case while opening the file following error is generated Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) Please guide, if any one knows the reason behind. More over how to fetch meta data of .xps files?modified on Thursday, April 17, 2008 4:06 AM
Same issue with my code!! (Exception from HRESULT: 0x80004005 (E_FAIL)) Did you find any solution for this??? Please reply