Skip to main content

Weblog Ton Stegeman [MVP]

Go Search
Home
  

ODC 2008
If you have a question or suggestion, please contact me through Windows Live Messenger.
My status: .

If I am not online, please send me an e-mail.
Weblog Ton Stegeman [MVP] > Posts > Read-Only SharePoint documents in Office 2003 - the Edit Document Library
Read-Only SharePoint documents in Office 2003 - the Edit Document Library

I am pretty sure you all have customers/users that use Word, Excel and PowerPoint 2003 in combination with SharePoint 2007. And you probably explained them all the when they want to edit a document, they need to open the context menu and select "Edit in ....". Instead of just clicking on the name in the view. This opens the document as readonly on Office2003.

image

Users then make changes to the document, hit the save button and get the Save As dialog. If 'Require checkout' is enabled, they need to save the document using a new name, because the document cannot be overwritten. It is pretty hard to explain and for users it is hard to get used to it.

image

I have created a custom document library schema that has 2 extra viewfields. These fields, when clicked make the Office applications behave just like when users click the link "Edit in Microsoft Word" for a Word document. After you installed the template and you open a Word document in Word 2003, Words asks if you want to check-out the document (if this is enabled, otherwise it just opens the document in edit mode).

image

I have called the document library an "Edit Document Library". You can download it from our CodePlex site. Before you install it, please note that you will only benefit from this when you use Office 2003. Office 2007 behaves like you would expect. After running the installer, and deploying the solution to your web application(s), your top level sites have a new site collection feature called "Edit Document Library":

image

After activating this feature, all subsites now have a new document library template available:

image

After you created your new document library, you are done. If you look at the view definition of the All Documents view, you will notice the new field that is selected as the "Name" field:

image

In fact, your library has 2 new fields:

  1. Name (linked to Edit document)
  2. Name (linked to Edit document, with edit menu)

The last part of this post is for those of you who are interested in how I created this library. In the schema.xml of the list template, I created the 2 new field definitions. I changed the DisplayPattern of the Name (linked to Edit document) field. The CAML part that actually renders the link now looks like this:

It renders a link to the document and when the user clicks this link, it calls the javascript function "editDocumentWithProgID2". It checks the ForceCheckout property of the list and the value of the Checkoutuser to find out the correct value for the check-out behavior.

<HTML><![CDATA[<A onfocus="OnLink(this)" HREF="#]]></HTML>
<HTML><![CDATA[" onclick="javascript:editDocumentWithProgID2(']]></HTML>
<Field Name="EncodedAbsUrl"/>
<HTML><![CDATA[', '', 'SharePoint.OpenDocuments',]]></HTML>
<FieldSwitch>
  <Expr>
    <ListProperty Select="ForceCheckout"/>
  </Expr>
  <Case Value="1">
    <IfEqual>
      <Expr1>
        <Column Name="CheckoutUser" />
      </Expr1>
      <Expr2></Expr2>
      <Then>
        <HTML><![CDATA[1]]></HTML>
      </Then>
      <Else>
        <HTML><![CDATA[0]]></HTML>
      </Else>
    </IfEqual>
  </Case>
  <Default>
    <HTML><![CDATA[0]]></HTML>
  </Default>
</FieldSwitch>
<HTML><![CDATA[, ']]></HTML>
<HttpVDir />
<HTML><![CDATA[', 0);">]]></HTML>
<UrlBaseName HTMLEncode="TRUE">
  <LookupColumn Name="FileLeafRef"/>
</UrlBaseName>
<HTML><![CDATA[</A>]]></HTML>
<IfNew Name="Created_x0020_Date">
  <HTML><![CDATA[<IMG SRC="/_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/images/new.gif" alt="]]></HTML>
  <HTML>$Resources:core,new_gif_alttext</HTML>
  <HTML><![CDATA[">]]></HTML>
</IfNew>

Please download the code from the CodePlex site if you want to see this snippet in the context.

Comments

There are no comments yet for this post.
Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Your city *


Type the name of the city you live in (making it easier to handle spam...)

CurrentDate *

Select the current date (see if this gives me fewer spam...)
Attachments

 Links

  SharePoint Object on CodePlex
  Screencast introducing SharePoint Objects
  Content by Type and Filter Web Parts on CodePlex
  Archive
  Archive (Calendar)

 My Latest Blog Posts

Scripting SharePoint 2007 setup: choices and conceptsUse SHIFT+ENTER to open the menu (new window).
Adventures in Visual Studio 2010: Migrate the Content By Type web part to SharePoint 2010Use SHIFT+ENTER to open the menu (new window).
Register SharePoint themes by using a featureUse SHIFT+ENTER to open the menu (new window).
SharePoint 2010 development on Windows 2008 Server R2 – Getting StartedUse SHIFT+ENTER to open the menu (new window).
New release SharePoint Objects: features and groupsUse SHIFT+ENTER to open the menu (new window).
Constructing the url to the SharePoint Edit Permissions pageUse SHIFT+ENTER to open the menu (new window).
Screencast: introduction to SharePoint ObjectsUse SHIFT+ENTER to open the menu (new window).
SharePoint 2007 and Reporting ServicesUse SHIFT+ENTER to open the menu (new window).
SharePoint Objects – Insight in usage of your SharePoint artifactsUse SHIFT+ENTER to open the menu (new window).
SharePoint 2007 Custom list schema and the Content Query Web PartUse SHIFT+ENTER to open the menu (new window).
SharePoint 2010 Silverlight Client Object Model – ExecuteQuery vs ExecuteQueryAsyncUse SHIFT+ENTER to open the menu (new window).
SharePoint 2010, the Client Object Models and Bing MapsUse SHIFT+ENTER to open the menu (new window).
Having fun with SharePoint 2010, Silverlight 3 and Bing MapsUse SHIFT+ENTER to open the menu (new window).
Connecting TFS 2010 projects to SharePoint sitesUse SHIFT+ENTER to open the menu (new window).
Adding a database to the SharePoint database Server using SPDatabaseUse SHIFT+ENTER to open the menu (new window).