I have created a C# project in Visual Studio 2008 that opens Word documents on a file share, reads their properties and copies them to SharePoint.
The problem is that simply opening the Word documents causes a save that changes the "date modified" of the file. We will have the files both places in a transition period, so this is a serious problem.
I have installed Office 2007 on my development server and I have added the following using statements:
using Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;
I open the Word documents with this code:
Word._Document oDoc = oDocs.Open(ref oFile, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
- and closes them with this:
oDoc.Close(ref wdDoNotSaveChanges, ref oMissing, ref oMissing);