Link from Document Library to UNC Path
Can anyone tell me if it is possible to create a link from a document library to a UNC path? I needto establish links to resources in an existing document repository, but Sharepoint presents the following message when attempting to add the link "Enter a valid document name and URL. Valid URLs must begin with 'http:' or 'https:'" Thanks in advance. Dave
February 11th, 2008 7:11pm

One approach would be to disable the part of the underlying Javascript that provides that validation in that dialog. If you do a search for 'a word or phrase in the file' under the 12 hive and look for "https", there are several Javascript files there containing such validation. I've never done this myself, so it's a little experimental, but easy enough to roll back if it has undesired results. I think your UNC path will be stored in Sharepointjust fine if you circumvent that initial validation.
Free Windows Admin Tool Kit Click here and download it now
February 11th, 2008 8:16pm

you can add the Page viewer web part and it will allow you to create a link to a file share
February 21st, 2008 6:03pm

Following are the steps to achieve this. 1) Create a site content type of type "link to a document" with "Document" as a parent content type. 2) Add the same to the document library. 3) Go in the layouts folder open newlink.aspx in Visual Studio IDE 4) add the following function to the script tag Code Snippetfunction HasValidUrlPrefix_Override(url) { var urlLower=url.toLowerCase(); if (-1==urlLower.search("^http://") && -1==urlLower.search("^https://") && -1==urlLower.search("^file://")) return false; return true; } 5) Replace "HasValidUrlPrefix" to "HasValidUrlPrefix_Override" in the newlink.aspx 6) IISReset and when adding a link to a file share. It shoudl be done in the following format "file://\\{ComputerName}\\}FileName}" it should work 7) Change the wss resource file present in app_globalresources to show the following message "Enter a valid document name and URL. Valid URLs must begin with 'http:' or 'https:' or 'file://'" Hope this should help. Regards, Mayur
Free Windows Admin Tool Kit Click here and download it now
March 25th, 2008 9:44am

sir, you are the MAN!!! saved me a lot of time. thank you
July 25th, 2008 12:03am

Or you could create a shortcut (.lnk) file to the UNC share. You may need remove .lnk from the blocked file types.Upload the .lnk file to your library and you are good..
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2008 1:25am

Moving this to the Admin forum as it doesn't seem to be anything specially Enterprise ...
July 28th, 2008 9:24am

This can also be done by creating a link using the following for your path file:\\UNCYou can do this in your navigation tree or a link library or a form library. However if you create it in your link library the "file:" is put there automaticly. Hope this helps.
Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2008 7:16pm

If I send the link of a LINK content type in an email message, the user cannot open the file by clicking on the link in the message. Copying and pasting this link in the browser works fine. An example is the NewPresentation link at: http://portal1/sites/sales/Docs/NewPresentation.aspx This does not work if you click on it, but works if you cut and paste it in a browser. Do you see a way around this? Thanks in Advance,Veera Reddy Kolan
March 30th, 2009 5:41pm

Hi there,I recently ran into a very simlar problem and ended up finding a quick work around for it one which doesn't require you to insert any additional functions(i didn't have the permissions to do this on the site). Here's what I did, so far it seems to be working fine.1) Create a new document link (ie. New->Link to a new document...in a shared workspace)2) When it asks for the url enter anything that it will accept(i used http://google.com). This will get you past the error with http: not being found3) Now click accept and go back to the main screen. Then edit the properties of this link; here is should give you the option to change the URL again. Enter the file://<comptername><filename.xls> component here. This time when you hitaccept it will not check for "http:" in your field.4)Give the new link a try. If it works anything like it did with me then you should be good to go
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2009 8:57pm

Has any one managed to get the above working in SharePoint Foundation 2010 as the code above is not working after we have upgrade to SharePoint Foundation 2010. Any info on this would be very usful to us right now. This is the code i'm refering to above function HasValidUrlPrefix_Override(url) { var urlLower=url.toLowerCase(); if (-1==urlLower.search("^http://") && -1==urlLower.search("^https://") && -1==urlLower.search("^file://")) return false; return true; }
October 1st, 2010 5:10pm

I don't think you can upload .LNK files for Document libraries - it only works for Lists. http://admincompanion.mindsharp.com/BillBlog/Lists/Posts/Post.aspx?ID=68
Free Windows Admin Tool Kit Click here and download it now
October 20th, 2010 4:24am

if you have a sharepoint document library say at https://mycompany/sites/FinanceDpt/Documents is there a way to use that as a file share like \\https://mycompany/sites/FinanceDpt/Documents ? I've tried and doesn't work. Is this not possible?
December 16th, 2010 3:25am

This does not work, for me anyway. On SharePoint 2010 the URL field is html encoded and the resulting value of entering a UNC path becomes file:////{servername}/{file} As a result I the redirect fails. Anyone else have this problem, or a solution?
Free Windows Admin Tool Kit Click here and download it now
September 21st, 2011 9:05am

Hi, Check out site URL: http://techtrainingnotes.blogspot.com/2007/08/sharepoint-adding-hyperlinks-to-doc.html
September 26th, 2011 4:49am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics