When you have an Microsoft Office document in a SharePoint library which has versioning enabled, and when you click directly on the file link inside the SharePoint interface, you’ll get the open-document dialog, where SharePoint is asking you how do you want to open the file – read only, or in edit mode.
If you open it in the read-only mode, you will not be allowed to save it back into the document library where you have opened it, at least not under the same file name.
The problem is, if you have a document URL, and you open it from any client application (your own solution, link in an e-mail message, whatever…), the file will always be open in the read mode. And this is the behavior that you most likely do not want.
There are two possible workarounds around this (actually, there are three, but we’ll ignore the third one, since it is not quite useful in production, it requires changes on the client side – on ALL clients).
The first one is, if you are developing custom HTML solution (does not matter if inside or outside of SharePoint), you can use the editDocumentWithProgID JavaScript function from SP.JS. This will show the open document dialog, just as you know it from SharePoint:
<a href="" onclick="editDocumentWithProgID2('http://server/site/doclib/folder/Document.docx', '', 'SharePoint.OpenDocuments', '0', 'http://server/site', '0')"> This will open the file in edit mode </a>
Of course, you will need to include the SP.JS file if you are outside of SharePoint – it is stored in the LAYOUTS folder of 14 hives for SharePoint 2010 (usually: C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTS)
The second option will be to replace “http://” in the document URL with “file://”. This will open the document directly in edit mode, without any prompting. From my experience, this works well in local intranets, causes troubles in public sites.
So the link from the previous case would be:
file://server/site/doclib/folder/Document.docx’
Have fun with SharePoint…