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.
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.

[...] Go to the author’s original blog: How to open SharePoint documents in Edit mode with Internet … [...]
By: How to open SharePoint documents in Edit mode with Internet … on January 13, 2009
at 1:25 am
I have also been having this problem for a while. I’m extremely glad you found that little bit of Javascript and decided to shared it!
By: Inflecto Systems - Web Based Applications on January 13, 2009
at 2:21 pm
I am glad that it helps someone
By: dotnetninja on January 13, 2009
at 2:43 pm
Do you know of a solution that would allow the links to automatically open in Office instead of IE?
ThankS!
By: Christian on January 29, 2009
at 5:12 pm
Hi
Check out this post if it help you to solve that problem (if I have understand correctly).
http://dotnetninja.wordpress.com/2009/01/29/how-to-open-documents-in-client-application-instead-of-web-browser/
By: dotnetninja on January 29, 2009
at 11:34 pm
Where did you accomplish “Main web application was modified to use this script when user clicks on the SharePoint link and all worked like a charm.” Whate file was modified?
By: person on February 4, 2009
at 8:15 pm
Hi
I had an script on Web Page which listed links to the SharePoint documents. I have updated script on that page so when user clicks on the link to open document new javascript is used to call function which handles that correctly.
If you are interested on functionality on that page I could provide code for it.
By: dotnetninja on February 4, 2009
at 8:27 pm
I may be interested in that. But do you think there is a way to change the link for all document libraries, so if I click on the filename of a document in any shared document library and any view, it will run the edidocumentwithprogid script? That is what I’m most interested in doing.
By: person on February 4, 2009
at 8:53 pm
Hi
Yes that is exactly what I have done, observe that my links are in an separate ASP.NET application, so I have not changed script on the SharePoint nor I am opening files through SharePoint user Interface.
In my case web page is loading all links(documents from different doc libraries) for specific user (each user has different rights) and rendered then on the web page(ASP.NET), and with click runing editdocu….
Is that what you are trying to do or do you want to change script on the SharePoint (which is not recommended).
By: dotnetninja on February 4, 2009
at 9:29 pm
I may not uderstand what “web page” is to you. I’m thinking of the page that is shown in the image with the atl text “editinmswordfirebug”. It seems you are saying you made a custom page that does this, which I assume is the 11 lines of code at the end of the blog that has a document hardcoded and not dynamic.
My users will be in sharepoint, at a doc library, and will need to click once to edit the file in word without using the dropdown.
I understand editing SharePoint may not be recommended, but I don’t see who else you can do it.
By: person on February 4, 2009
at 9:55 pm
Hi
Page on the blog entry is just simple example, this solution is applied on production web application where page with link is dynamical,…
But in your case that will not do the trick, because users are interacting with SharePoint UI. In that case I do not see it like a big problem to use dropdown for each item in the library (SharePoint). Another way is to apply registry fix for each client machine.
I assume that users are using office 2003, because in office 2007 users are prompted with choice how to open document.
So I your case I would advise users to use dropdown if they want to edit document.
By: dotnetninja on February 4, 2009
at 10:30 pm
Thank you, you have been very helpful. You are correct that it would be easier to use the drop down in my case, but what I am doing is attempting to override the menu so I can open a document through a citrix delivered app instead of edit in a local version of word. Using citrix wisp, there is a menu item to open the doc using the citrix delivered app. So I wanted to override the single click to do this instead of open on local copy of word. So instead of run the editinms.. onclick, i would run the onclick event to open the doc in citrix.
To accomplish this, all I need is to find the location in sharepoint to change the click action.
By: person on February 4, 2009
at 10:44 pm
Hi again
If you change SharePoint script and you get update from Microsoft via Windows Update or something else which updates SharePoint functionality and maybe even scripts you will lose your change.
In that case you will need to make the change again (if you are still in the same company). If you leave company without any documentation on that change users my find themselves with non working functionality.
Still if you really need to change script main script is core.js located in C:\program files\common files\Microsoft shared\web server extensions\12\Template\layouts\1033. There is another javascript file needed to be changed but you will see if you follow functions.
First copy core.js and rename copied file to mycore.js (or something else) and make changes to that file.
Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL and open default.master and create custom master page with these lines
Replace default.master with new master page.
Doing this you are not modifying core.js.
By: dotnetninja on February 4, 2009
at 11:04 pm
Great article & I feel I’m close to achieving what I want, but…
Being a relative newbie to this, could you tell me how I can use this js in my application?
I have a SP list with hyperlinks to files held in SP doclibs. I want users to be able to click on these links and go straight to editing the docs. Is this possible (& if so, how) or have I misunderstood the functionality behind your script?
I’m using office 2003.
Thx
By: custardcrumble on February 16, 2009
at 2:34 pm
Hi
You have not misunderstood, that is exactly this js is for.
I will upload an simple page on the same catalog where sp.js resides which uses this script to open SharePoint docs. in edit mode.
If you need something more, please feel free to contact me again.
By: dotnetninja on February 16, 2009
at 3:18 pm
Hi, thanks for the quick response
)
I think I’ve identified my problem. I’m trying to put all this code in an Enhanced Rich Text field (where the link will reside) and each time I submit the form it strips all the javascript out – presumably to prevent anything malicious from going on.
Do you know if there’s a way to stop SP stripping out the js? Or a workaround to open a document for editing from a link in a list?
Thx again.
By: custardcrumble on February 16, 2009
at 3:56 pm
Hi
If I understand correct you have links in Enh.Rich text filed inside SharePoint? I thought that you had some external web site accessing Shapoint documents.
Do the users have access to SharePoint? or SharePoint document library?
Why did you put links inside text field?
By: dotnetninja on February 16, 2009
at 10:23 pm
Hi,
That’s correct. It’s a long story but yes, the users have access to SP but they can be a bit hard of thinking. The idea is to get lots of information in the same list with a number of views to make the info easily navigable. Part of the information required is held in word/excel files and confusingly, there may be up to 8 links per record (but I want to keep groups of them together as they are the same document in different languages so I chose to keep them in 3 text fields (I know a hyperlink field seems to make more sense!)).
The users are liable to get confused if they have to use 3 document libraries as well as the default list, so I was hoping to link straight to the relevant documents from my list. Am I just being daft or is there a way of doing this?!
Thx
CC
By: custardcrumble on February 17, 2009
at 8:56 am
Hi
In that case you do not have to use javascript (sp.js) because all necessary scripts are already loaded in SharePoint site. Did you tried just to write Edit onclick inside your text field?
In your case I would do an custom web part with all necessary functionality, collection information from all document libraries you have and presenting in web part.
By: dotnetninja on February 17, 2009
at 11:50 am
Hi,
thanks for the advice. I’ve been banging my head against a wall over this and can’t get the links to open right. I’ve tried Edit onclick too but that doesn’t work. I’ll try a new webpart but not sure how that will open non-read-only when I can’t do it from a list.
Wish me luck…!
By: custardcrumble on February 17, 2009
at 3:44 pm
Parabéns! Tks! Resolveu todos os meus problemas! Muito Obrigada!
By: Elicinei on February 19, 2009
at 1:37 pm
Hey…just wanted to say thanks for this. I’ve been working on a ASP.NET project to display the contents of a document library and provide similar functionality (check in/check out/delete).
Your work has saved me tons of time.
Thanks again.
By: Guy on March 3, 2009
at 9:18 pm
By: dotnetninja on March 3, 2009
at 9:24 pm
Your article is great! thanks for the information. I just came accros your blog, and my problem is that I am working on a new Sharepoint site ( Intranet for our comany) I had two accounts ( normal & Admin account) and have full control on both. Using my Admin account force me to open files in read-only mode even after I check them out, it says that the file is used by ( ..my account) and can’t save changes on same path. I’m in a big mess, I tried my normal account and I can check out/In and save files. other user with limited access is also able to do the same.
Does this error have a relation to my -admin-user account or with js as you mentioned?
plzzz help
By: Nassima on April 7, 2009
at 9:40 am
Hi, i am glad that it helps you.
I got this problem with combination of OS which was Windows XP, office 2003 and SharePoint (wss 3.0)
Are you also using office 2003? So my error has nothing to do with admin part, check what is the difference between you account and admin account (security in sharepoint).
Did you have created document library (your account) or admin?
By: dotnetninja on April 7, 2009
at 10:14 am
I am using Office 2007 and IE6 but seem to be having this same problem. I have a user who no matter what rights I give him to the SharePoint site cannot open any document in edit mode. It is possible that he has remnants of Office 2003 running in the background somehwere. He also does not have Active X installed. Not sure if that has anything to do with it. Any thoughts on this?
By: kj on June 12, 2009
at 4:06 pm
[...] Opening the file a different way (Edit with…) [...]
By: WSS Document Library Read-Only Problem « TechJen on July 16, 2009
at 3:20 pm
Man, you’re magical, thanks a lot!!!
By: Andrey on August 26, 2009
at 10:14 am