Go to Dashboard
ThreeWill Home Page | ThreeWill's Service Catalog | Learn More about ThreeWill | Careers at ThreeWill | Contact ThreeWill
Bookmark and Share

External Link for Editing a SharePoint Document

Have a need to edit a document that is stored within SharePoint, but provide the link within another application?

Using just the URL to the document will only give you read-only access to the document, but a little bit of digging on the javascript involved provides a fairly simple solution.

Note that this has only been tested with Word 2007 and Excel 2007.

The short answer is to reference the following scripts (I do this in the <HEAD> section of the page):

<script type="text/javascript" language="javascript" src="http://<sharepoint server>/_layouts/1033/init.js"></script>
<script type="text/javascript" language="javascript" src="http://<sharepoint server>/_layouts/1033/core.js" defer></script>

For example:

<script type="text/javascript" language="javascript" src="http://tw-lt-m90-001/_layouts/1033/init.js"   ></script>
<script type="text/javascript" language="javascript" src="http://tw-lt-m90-001/_layouts/1033/core.js"    defer></script>

Then have the following for the link:

<A onfocus="OnLink(this)" HREF="<document url>" onclick="return DispEx(this,event,'TRUE','FALSE','TRUE','','0','SharePoint.OpenDocuments','','','','21','0','0','0x7fffffffffffffff')">
 <document name>
</A>

For example:

<A onfocus="OnLink(this)" href="http://tw-lt-m90-001/Documents/Hello%20World.doc"  onclick="return DispEx(this,event,'TRUE','FALSE','TRUE','','0','SharePoint.OpenDocuments','','','','21','0','0','0x7fffffffffffffff')">

Hello World

</A>

Here is a full example that includes the icon for the file type as well.

<HTML>

<HEAD>

<title>Documents</title>

<script type="text/javascript" language="javascript" src="http://tw-lt-m90-001/_layouts/1033/init.js" ></script>

<script type="text/javascript" language="javascript" src="http://tw-lt-m90-001/_layouts/1033/core.js"  defer></script>

</HEAD>

<BODY>

<TABLE width="100%" cellspacing=0 cellpadding=0 border=0>

<TR>

<TD>

<A TABINDEX=-1 href="http://tw-lt-m90-001/Documents/Hello%20World.doc"  onclick="return DispEx(this,event,'TRUE','FALSE','TRUE','','0','SharePoint.OpenDocuments','','','','21','0','0','0x7fffffffffffffff')">

<IMG BORDER=0 ALT="Hello World.doc" title="Hello World.doc" src="http://tw-lt-m90-001/_layouts/images/icdoc.gif" >

</A>

</TD>

<TD>

<A onfocus="OnLink(this)" href="http://tw-lt-m90-001/Documents/Hello%20World.doc"  onclick="return DispEx(this,event,'TRUE','FALSE','TRUE','','0','SharePoint.OpenDocuments','','','','21','0','0','0x7fffffffffffffff')">

Hello World

</A>

</TD>

</TR>

</TABLE>

</BODY>

</HTML>

To reference an icon it is simply "ic<ext>.gif" (http://<sharepoint url>/_layouts/images/ic<ext>.gif, e.g., http://tw-lt-m90-001/_layouts/images/icdoc.gif). For a full listing of icon files see all "ic*.gif" files in the TEMPLATE\IMAGES directory under the 12 hive.

Labels

bigbagofuitrips bigbagofuitrips Delete
integration integration Delete
codesamples codesamples Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.