This post was resting on my unfinished blog list for more than one month now and it is time to finish it. It is also my first SharePoint post (I think
).
If you ever tried to open SharePoint document from SharePoint document library and you have Microsoft XP and Office 2003 installed on your machine, you may have discovered that file in SharePoint which you click, to open is always open in “Read Only” mode (read only permission) and you cannot make changes to the document.
If you click on an Office document in SharePoint to open it – it loads it in the relevant application (if you have configured client to open it in the client application), but in Read-Only mode.
In my case I had list of files in Web Application which represented list of SharePoint documents that specific user had permission to Read and Edit. This list was retrieved using custom SharePoint web service which I will cover in my next SharePoint posts (creating custom SharePoint web service).
Because I have tested this Web application using my virtual machine (SharePoint, WSS 3.0) with my computer using Vista and Office 2007 I have received nice pop up message with choice to open file in Read Or Edit mode, like the image below.

SharePoint Document Open Choice
But what I have learned is that ActiveX which Internet Explorer 6 is using on the machine where you have Office 2003 is not the same as on my Vista machine (with Office 2007 and IE7).
To save document user needed to know which document library filed belongs to and then manually navigate to it. That was not acceptable.
After searching the web I found workaround that should work http://support.microsoft.com/?kbid=870853. According this article:
- Quit all running Office 2003 programs.
- Open register (regedit.exe)
- Locate and then right-click the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Internet
- Point to New, and then click DWORD Value.
- Type OpenDocumentsReadWriteWhileBrowsing, and then press ENTER.
- Right-click OpenDocumentsReadWriteWhileBrowsing, and then click Modify.
- In the Value data box, type 1, and then click OK.
- On the File menu, click Exit to quit Registry Editor.
But, what if you are working in large corporation and you can not so easy push this registry change to all machines?
Or like in my case what if there are some other web based applications that do not permits opening documents in Edit Mode, but just Read Only mode?
And you can not make changes to this applications or even do not have access to those.
So it seems like a dead end, registry fix is needed to fix the problem but you are not allowed to make it or it mess up something else.
There is an workaround to open document from SharePoint in Edit mode.
If you “pull down” menu for the item in the SharePoint document library there is one menu item “Edit In Microsoft Word/Excel,…” like the image bellow.

Edit in Microsoft Word
After clicking on the item you are able to open file in Edit mode!, aha we are close.
There is also some javascript on work here behind the scenes that calls the right function to open the file.
My solution was to open SharePoint document library using Firefox and using the Firebug search for text (in this case) Edit in Microsoft Word.
The result of that search was call to function editDocumentWithProgID2 with correct in arguments for that file. See image bellow.

FireBug Edit in MS Word result
After further searching for this function in the SharePoint javascript files on the SharePoint server I found most of the needed functionality in Core.js.
I have extracted function needed to separated file and created simple web application with this reference to this script to test this functionality.
Here is the HTML of the page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<title></title>
<form id="form2" runat="server">
<div>
<a href="http://demo-1/blankpage/Newdoclib/fold1/fold2/BLLayer.doc">link to file</a>
<a href="" onclick="editDocumentWithProgID2('http://demo-1/blankpage/Newdoclib/fold1/fold2/BLLayer.doc', '', 'SharePoint.OpenDocuments', '0', 'http://demo-1/blankpage', '0')">Edit onclick</a></div>
</form>
<script src="sp.js" type="text/javascript"></script>
After testing I was able to open file in the Edit mode without using registry fix.
Main web application was modified to use this script when user clicks on the SharePoint link and all worked like a charm.
Crunched Javascript file needed for this test can be found here.