Edit the NewLink.aspx page to allow the Document Library to accept a File:// entry.
- Go to the Front End Web Server \12\template\layouts directory.
- Open the file NewLink.aspx using NotePad. If I have to tell you to take a backup of this file first then you have no business editing this file (really).
- Go to the end of the script section near top of page and add:
if (-1==urlLower.search(”^http://”) &&
-1==urlLower.search(”^https://”) && -1==urlLower.search(”^file://”))
- Use Edit Find to search for HasValidURLPrefix and replace it with HasValidURLPrefix_UNC (you should find it two times).
- File – Save.
- Open command prompt and enter IISreset /noforce.
Important: To link to Folders correctly you must create your own content type exactly as below and not use the built in URL or Link to Document at all.
Create custom Content Type
- Go to your Site Collection logged in as a Site Collection Administrator.
- Site actions – Site Settings – Modify All Site Settings.
- Content Types
- Name = URL or UNC
- Description = Use this content type to add a Link column that allows you to put a hyperlink or UNC path to external files, pages or folders. Format is File://\\ServerName\Folder , or http://
- Parent Content Type,
- Select parent content type from = Document Content Types
- Parent Content Type = Link to a Document
- Put this site content type into = Existing Group: Company Custom
- At the Site Content Type: URL or UNC page click on the URL hyperlink column and change it to Optional so that multiple documents being uploaded will not remain checked out.
Add Custom Content Type to Document Library
- Go to a Document Library
- Settings – Library Settings
- Advanced Settings
- Allow Management Content Types = Yes
- Content Types – Add from existing site content types
- Select site content types from: Company Custom
- URL or UNC – Add – OK
- Click on URL or UNC hyperlink
- Click on Add from existing site
- Add all your Available Columns – OK
- Column Order – change the order to be consistant with the Document content type orders.
- Click on your Document Library breadcrumb to test.
- View – Modify your view to add the new URL or UNC column to your view next to your Name column.
Create Link to Document
- Go to the Document Library
- New – URL or UNC
- Document Name: This must equal the exact file or folder name less the extension.
- Example: My Resume
- Example: Folder2
- Example: Doc1
- Document URL: This must be the UNC path to the folder or file.
- Example: http://LindaChapman.BlogSpot.com/Folder1/Folder2/My Resume.doc
- Example: http://LindaChapman.BlogSpot.com/Folder1/Folder2
- Example: File://\\ServerName\FolderName\FolderName2\Doc1.doc
You might see other blogs that say you can’t connect to a folder and must create a shortcut first. They are wrong. You can by the method above.
The biggest mistakes I see are:
- People click on the NAME field instead of the URL field. They are not the same. You MUST click on the URL field to access the Folder properly.
- People use the built in Link to Document content type thinking it is the same or will save them a step. It is not the same.
- People type the document extension in the Name field. You can not type the extension in the name field. It will see it is a UNC path and ignore the .aspx extension.
- People enter their slashes the wrong direction for UNC paths.