Reputation: 127593
I have a WCF service running on the sharepoint server that will generate a document in a library and return its uri. I have a client application that calls the WCF service and launches word with edit privileges of the document that was just generated. However if I just pass word the URI of the document it will open the document in Read-Only mode. Trying to save back to the server overwriting the old file gives the error saying the document is Read-Only when saving.
How do I, from code, launch word with the ability to save changes back in to the file it opened on the sharepoint server?
Note: This is not a permissions issue, if I manually go in to the sharepoint site I have rights to click on the document and open as edit.
EDIT: Ok, So I think I know how to do it (I am going to make a dll and have rundll.exe launch word and do the babysitting). However I still would like to know if there are any other solutions than manually checking in and out the document.
Upvotes: 0
Views: 4591
Reputation: 127593
I did not need to check out the document, what I found out is I needed to launch iexplore.exe
pointing at the URI using the following code.
Process.Start("iexplore.exe", ((FileDetails)e.Result).Address);
where FileDetails
is the custom object the WCF service is returning and .Address
is the URI of the document.
Upvotes: 1
Reputation: 25694
You need to check out the document before opening it.
SPListItem item = GetListItem();
item.File.CheckOut();
how to check-out document in document library programmatically in sharepoint
Upvotes: 0