Monday, January 23, 2012

SharePoint - Link to file shares in Document Libraries

In SharePoint you can't create links to files like file://xxx/ because the link field type only accepts http:// or https://.

If you use Internet Explorer in your company you can use a trick. The network shares are usually mapped to local drives like H:. It is better if you use directly the name of the mapped server folder instead of the local drive letter, so everyone can use the link.

1.Way - Redirect with html file

Create an .html (or .aspx in SharePoint Online) file with the following code and upload it to your document library. It will open the html file which itself opens the folder or file in a new window. With history.back() it returns to your doc lib.

  <script type="text/javascript">
    // mapped network folder H:
    var filer = "file://servername/e$/Folder1/Folder2/Data"    
    // folder within the mapped (which you see in explorer)
    var folder = "/Folder3/Internal/projekts/security" + folder, "File");

2. Way - Modify NewLink.aspx

Another way to archive is posted by Linda Lee Capman here. The core idea is to use the "Link to Document" content type. You can add this content type to your document library and link to other documents. Normally you can enter only http or https links there.

The NewLink.aspx is the page where you enter the link. Here you can modify the javascript function, which checks if the entered URL begins with http or https.

The idea is great, but with cumulative updates or patches the newlink.aspx can be resetted. It would prefer if you make a copy of the newlink.aspx and rename it to newlink_custom.aspx and add the javascript code there.

Newer tested if this functions really, just try.

3. Way - Modify Link

Another easy way to create a link to a filer is to add the "Link to Document" content type into your Document Library.

Now create a link to any document with this content type. After that download a copy of the link to your local computer.
Download a copy of "Link to Document"
Open the downloaded file with your favorite editor. Change the two marked parts and enter the path to your File Share:

Modify Code
Now upload the aspx page again to your library.

Tuesday, January 17, 2012

People Picker doesn't show single imported users

I had a strage issue last day. The people picker did not show single users from an imported AD group. I looked at the user profile store and could find the user. I started a full profile import and could find the user in the user profile database again. (I thought perhaps the account was deleted in the AD)

But when I search for the user in the people picker the user could not be find. Other users from the same AD group could be found with no problem.

After all the reason was that the account was not active. The people picker only searches for active user accounts.

You can check if an account is active or not with the following dos command:
net user *username* /domain | find "active"

(Replace *username* with the loginname of the user)