Link to a Document Opens in Read Only Mode

Common Scenario: You have a links list full of links to various documents within your Intranet. Or, you are using the Link to a Document content type to link to documents.

Issue: When clicking on those links, users aren’t prompted for whether or not they want to open the documents in Read Only or Edit mode. Instead, the files are opened directly in Read Only mode. Attempting to save a document after making edits, will only result in an error that the document is a read only document. This can be confusing for users.

Some things to note.

  1. This is an issue anytime you link to a document, or even within the out of the box search results. It will always resort to read only mode, regardless of your permissions.
  2. The mechanism MS uses to provide the PROMPT users are used to is this:
  3. <A onclick="return DispEx(this,event,'TRUE','FALSE','FALSE','SharePoint.OpenDocuments.3','1','SharePoint.OpenDocuments','','','','1','0','0','0x7fffffffffffffff')" href="/sites/SP2010/Shared%20Documents/A/Document1.docx">Edit Document</A>

So there is a function called DispEx that takes in a bunch of parameters that makes this magic work. When a user clicks on a document, it will prompt them for whether they want to open in read only or edit mode.

Here is what it looks like when you dig into the Link to a Document content type link:

<A onclick="return DispEx(this,event,'TRUE','FALSE','FALSE','','1','SharePoint.OpenDocuments','SharePoint.Link','','','1','0','0','0x7fffffffffffffff','icdocx.png','linkoverlay.gif')" href="/sites/SP2010/Shared Documents/Document1.aspx">Innovation Games Links</A>

You can see that some parameters are changed and ultimately the href points to a different location. Instead of pointing to the source file, it’s pointing to the link.

So how do we resolve this?

Well a few options to consider.

  1. We could potentially write a global javascript handler that replaced all of these links with the correct onclick call. This is not a good idea, as it could potentially be a performance issue and would be hard to maintain.
  2. You could make manual links and use the format as specified above. So something like:
    <A onclick="return DispEx(this,event,'TRUE','FALSE','FALSE','SharePoint.OpenDocuments.3','1','SharePoint.OpenDocuments','','','','1','0','0','0x7fffffffffffffff')" href="/sites/SP2010/Shared%20Documents/A/Innovation%20Games%20Links.docx">Edit Document</A>

    But replace the href with your actual document url. This is very manual and not very robust, but it does work.

  3. You could choose to enforce checkout within Versioning settings of the document library. This will open the file and prevent the user from making any edits until they choose the checkout option.
  4. And finally, you could add a registry key as per this KB article that will force all links to open in edit mode. This worked when I tested it quickly. But you should test how it behaves when a user doesn’t have permissions to the document. You could then use a group policy to push this change to all client machines.
  5. Does anyone have anything else to add?

No comments yet.

Leave a Reply