troubleshooting Question

Opening Word document creates unwanted save

Avatar of kasperEH
kasperEHFlag for Denmark asked on
C#Microsoft Word.NET Programming
2 Comments1 Solution234 ViewsLast Modified:
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);




ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros