Wednesday, December 2, 2009

Edit Document from MOSS 2007 with Office 2003

I had a case with customer (who uses Office 2003 ~4000 PCs and approximately 150 computers with Office 2007) where if the users try to open office document from MOSS 2007 with Office 2003, the file is always opened as read only. Our custom application needs to open the doc for edit and check it out. So, the result were – it is not supported by Office 2003.

What is supported and what not, is described here

Finally, after customization of CORE.JS we succeeded to run Office 2003 to work as 2007 and these steps are described below :)

In the beginning I need to say, that this blog post were very important, regarding the chosen technical approach

1. I created empty file in the following path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033\Checkout.JS

2. I got the code of DispDocItemEx function from CORE.JS file (in the same folder) and paste it inside the new one

3. In Checkout.JS I modified the code:

Original:

================

else

    {

    fRet=stsOpen.ViewDocument2(window, szHref, szAppId);

    }

================

Modified:

================

    else

    {

    if (ctx.isForceCheckout==true)

    {

    fCheckoutForEdit=confirm(L_ConfirmCheckout_Text);

        if (fCheckoutForEdit==true)

        {

        CheckoutDocument(ctx.HttpRoot, szHref, null);

            fRet=stsOpen.EditDocument2(window, szHref, szAppId);

            }

       else

       fRet=stsOpen.ViewDocument2(window, szHref, szAppId);

    }

    else

    fRet=stsOpen.ViewDocument2(window, szHref, szAppId);

    }

==================

4. I created a copy of C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\GLOBAL\default.master with name custom.master

5. Added the following code just after the red line

<SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server" />

<!-- Checkout JS customization BEGIN -->

<SharePoint:ScriptLink language="javascript" name="Checkout.js" Defer="true" runat="server" />

<!-- Checkout JS customization END –>

6. I uploaded custom.master into http://myportal/sites/mysitecollection/_catalogs/masterpage, published and approved the new file.

7. The next step were to configure the site to use customized master page

clip_image002

8. During the tests I found, that if I click on the file link (in document library page /AllItems.aspx) Office 2003 has the same behavior as Office 2007.

clip_image002

clip_image002[7]

The file is checked out, “Shared workspace” pane is opened and on document close the following windows appear

clip_image002[9]

But, here I want to make a note, that if you try to open a document in any other fashion (such hyper link in email or web page), the CheckIn-CheckOut menu items and/or TaskPane functionality may not be available or work as expected. This modification only affects the behavior of the document library page.

No comments:

Post a Comment