You are hereAdding a Link to a SharePoint Document Library


Adding a Link to a SharePoint Document Library


By hagrin - Posted on 03 March 2009

Updated - 13 November 2009 - I have updated this post to improve on the JavaScript listed below so that the Back Button works properly.

Recently, a client wondered how they could add an external document to a document library that existed on their Intranet. The problem with just saving their document and uploading it to the Intranet is a matter of document "freshness" as changes are made by the document owner. Therefore, creating an external link to that document is a much better solution. However, adding a link to a document library would seem difficult on its face.

To get around this issue, I took the following steps -

1. Create a TXT file.
2. Open the TXT file and add the following HTML -

<html>
<head>
<title>External Link</title>
<script type="text/javascript">
window.self.location.replace('http://www.somesite.com');
</script>
</head>
<body>
</body>
</html>

3. Save the file as a HTML file.
4. Upload to your Document Library.

You now have a working JavaScript redirection to the external document in your document library. Also, you can click the Back Button in your browser and you will return back to your Document Library.

It works,

thank you very much for your help.

Thanks,
mohan

It works! Thanks so much. I can now create a re-orged sub-site consisting of pointers to the tragic (but will be hidden) folders and files.

http://www.ncoachoutlet.com/ coach outlet coach outlet online usa
http://www.smichaelkorsoutlet.com/ michael kors outlet usa michael kors purses
http://www.new-michaelkorspurses.com/ michael kors purses outlet online
http://www.mk-michaelkoroutlett.com/ michael kors outlet stpre
http://www.guccishoeoutletfactory.net/ gucci shoes outlet online
http://www.northfacenoutletonline.net/ north face jackets outlet online
http://www.monstervheadphones.com/ monster beats outlet online
http://www.coach-storesonline2013.net/ coach outlet store online

I have to reorganize a Sharepoint site that is organized like a rat's nest. Meanwhile, the development files can't be moved because they are using special templates with back-end software that links all their files together.

I could use this code to create a document library front end to reorganize the way files are displayed without actually changing the real file structure.

However, the back button doesn't work. Is there a way to add referrer code to the javascript in the HTML file so that the back button works?

thanks a lot! it works perfect!

Great question.

I have updated the post with some JavaScript that keeps the Back Button functioning properly. Good luck and thanks for posting.

Thank you for a timely post - I too am cleaning up a rat's nest.

Is there away the script can open the document in a new window?

Thank you,
Betsy

@Betsy - Thanks for your post. What type of documents are you looking to open up in a new window? If they are documents that already open up within a browser (i.e. like a PDF using the Acrobat/Foxit plugin), you should be able to use the same method as prescribed above - instead of linking to a page, just link directly to the document. However, this method depends entirely on how the user's browser is configured.

Hope this helps.