Reading MS Office XML document properties using WindowsAPI Code Pack fails on server

346 Views Asked by At

I have written a small C# application that displays the "Date Last Save"-property of an Office Document, using the WindowsAPI Code Pack:

ShellFile file = ShellFile.FromFilePath(absolutePath);
DateTime result = (DateTime)file.Properties.GetProperty("System.Document.DateSaved").ValueAsObject;

This works perfectly on my local machine and others, but somehow on the server it returns an invalid value (the modification date of the file system, which can differ from the "Date Last Save" property) when done on Office XML file formats (i.e. docx, xlsx and pptx). On "old" formats (doc, xls, ppt) it does work.

Anyone an idea what could be causing this? I have already re-installed and online-activated Microsoft Office 2010 on this server (twice) and rebooted the server a lot of times, but still having the same results.

Edit:

Still haven't exactly pin-pointed the problem, but I think it might have something to do with compiling it to x86 vs x64.

0

There are 0 best solutions below