0

I have a MS Office Word addin that contacts a service to upload and checkin the current Active document into SharePoint and does some other magic. My issue is that if I try to save the document again I get an error in the Status bar of Word saying that a refresh is needed.

I have tried to use the Interop.Word _Document object to refresh the document or to reload the document but it does not work, and the _Document.Sync.GetUpdate() seems to not even do anything.

Also I tried using the SharePoint Object Model but ran into a few issues.

So the question is How can I refresh the document inside Word using the Interop libraries or another API that I might be missing?

PS: I already asked this question on https://stackoverflow.com/questions/31789474/refresh-sharepoint-document-programmatically-in-ms-word-addin but I was unsure it would also be seen by this community.

0

The problem is, that the code in the background changes the document in SharePoint, so word will inform you that there is a newer version. The same thing happens if you have a EventReceiver on the DocumentLibrary, that would make changes to the document upon document updates.

Have you tried explicitely checking out the document before starting to work with it?

3
  • Yes to better describe the actions, the user goes to SharePoint clicks edit in word, word document opens and the user checks out the document. After this the user does something then saves the document (every thing seems fine here) and our service saves the changes but keeps the document checked out (as we want it). Then the user does more changes and saves the document and now Word shows a status bar saying that it needs a refresh. – PPPereira Aug 5 '15 at 9:17
  • May I ask why you're using an addin to save the document instead of the standard out-of-box Word->SharePoint save functionality? Maybe the background information would give me a clearer picture of the context. – Swiss Dev Aug 5 '15 at 9:20
  • We do some magic in the background but I am following your idea and I am doing as much as possible with the standard interop API (did half of what I wanted right now) so I am going to vote your answer as correct. Thanks @Swiss – PPPereira Aug 10 '15 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.