This post is by Yeshwanth Channaraj.

There is a well-documented sample program, DSOFile, that enables reading and writing Office document properties (both old format files like *.xls, *.doc and *.ppt, as well as the new open xml formats like *.xlsx, *.docx and *.pptx). The DSOFile sample is compiled as 32 bit.

If you are using this sample in a 32 bit application on a machine with Office 2007 SP2 , Windows 64 bit, then DsoFile will not be able to fetch the properties of Open Xml format files.  This is because Office 2007 SP2 did not ship the 32 bit version of msoshext.dll (shell extension handler) which is the component DSOFile uses to read/write properties from Open XML files . 

This issue is fixed in hotfix KB 2483216. This is also included in the Office 2007 Cumulative Update for February 2011 and subsequently in Office 2007 SP3.

The Office 2010 version of he hotfix is KB 2483230. This is also included in Office 2010 Cumulative Update for February 2011 and subsequently in Office 2010 SP1

If you wish to use DSOFile from a 64 bit program, then you should recompile the DSOFile to target for 64 bit.

An alternative approach to using Dsofile would be to use Open Xml SDK (or System.IO.Packaging). A sample that demonstrates this is given below :-

// *****************************************************************************
// This sample is provided "AS IS" with no warranty or support from Microsoft.
// It is a demonstration, provided for informational purposes only, and has not been rigorously tested with all environments and does not contain error handling.
// It is up to you to make it "production ready" if you use it in any development solution.
// *****************************************************************************


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using System.Xml.Linq;

namespace DocPropertiesOOX
{
class Program
{
static void Main(string[] args)
{
string filePath = @"C:\Users\test\Desktop\testzip.xlsx";
try
{
using (SpreadsheetDocument package = SpreadsheetDocument.Open(filePath,false))
{

CoreFilePropertiesPart coreFileProperties = package.CoreFilePropertiesPart;

System.IO.Stream stream = coreFileProperties.GetStream();

XDocument xdoc = XDocument.Load(coreFileProperties.GetStream());

// Display default properties
IEnumerable<XElement> awElements = from el in xdoc.Descendants()
where el.Name.Namespace == "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
select el;
foreach (XElement el in awElements)

Console.WriteLine(el.Name.LocalName + " = " + el.Value.ToString());

Console.ReadLine();
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}