‘Edit Document’ button instead of ‘Check Out’ when opening a Word document

Error:

“A problem occurred while connection to the server. If the problem continues, contact your administrator.” when trying to edit a Word document opened in read only mode in SharePoint 2010. The only way to edit a document now is to first Check Out the document in SharePoint then open the document for editing in MS Word.

The problematic library was created using Visual Studio 2010 wizard for creating a list instance in a SharePoint project.

Problem:

When a document that is not checked out is opened in MS Word ‘Edit Document’ button is shown (Screenshot 1.) instead of ‘Check Out’ button (Screenshot 2).

This document was opened from a server in read-only mode. Edit Doucment

This document was opened from a server in read-only mode. Edit Document

Screenshot 1.

To modify this server document, you must check it out. Check Out

To modify this server document, you must check it out. Check Out

Screenshot 2.

After clicking ‘Edit Document’ the following error is shown (Screenshot 3):

A problem occurred while connection to the server. If the problem continues, contact your administrator.

A problem occurred while connection to the server. If the problem continues, contact your administrator.

Screenshot 3.

Non of the solutions for similar problems I found online solved my problem. had to check the schema of the library and investigate with Fiddler.

After comparing the schema of a list created with the UI (this library works fine) and a the schema of the document library created with Visual Studio 2010 (this library has the problem) I noticed that the library created with the UI has no “/Lists/” part in the URL while the library created with Visual Studio has the “/List” part in the URL.

It turned out that Microsoft Word is trying to access the library by using URL composed as webUrl + Library

So to avoid this problem when creating document libraries with VS the part “/Lists/” should be removed from the URL.

Screenshot 4.

Relative Url for deployment

Relative Url for deployment

Since that time I always double check the URLs of lists and libraries when created with Visual Studio.

Good Url for document libraries: webUrl/DocumentLibrary1

Bad Url for document libraries: webUrl/Lists/DocumentLibrary1

For standard lists it doesn’t matter the “/Lists” part in the URL. Anyhow, for standard list (not document libraries) I prefer to include “/Lists” in the URL.

If creating a new library without /Lists part in the Url is not an option for you then another solution would be to change the URL of the existing library. I didn’t have to do that in my situation because there were not that much documents in the problematic library.
Changing just the URL of an existing library without recreating it deserves a separate post because there may be other issues to consider in that case.
In both cases one of the problems I can think of is if there are a lot of documents already in the library and in their content they reference other documents in the library. Changing the URL of the library will break those links so all the old hyperlinks in the documents content must be corrected manually or programmatically.

URL of an existing library can be changed with PowerShell, Windows Explorer or SharePoint Designer. For more details how to change the URL of an existing list check my other post
Change the URL of a SharePoint list or library

Update:

I tested by changing the URL of the same document library and the problem I expected with broken links in the documents content is not present. The hyperlinks are corrected automatically.
I investigated one document just after fixing the URL and before opening it in Word. I checked in \word\_rels\document.xml.rels and the hyperlinks were already corrected and were using the new URL of the document library without the “/Lists” part.
In \word\_rels\settings.xml.rels I noticed a Relationship element with Type=…./attachedTemplete with Target set to the document library’s document template using the old URL but that didn’t cause any problem and got fixed automatically with the first opening of the document in Word.

So far I haven’t notice any issue after changing the URL of the problematic library so creating another library with good URL is not necessary. Correcting the URL of the same library works fine and solves the problem.

Advertisements

One Response to ‘Edit Document’ button instead of ‘Check Out’ when opening a Word document

  1. Pingback: Error editing Read-Only word files after clicking Edit Document | Williams notatblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: