SharePoint : Document ID link redirection fails for some file types (like png, jpg, mpp, etc)

In one of the application, we are using Document ID for permalink in document libraries. We are storing documents of different file types (like docx, xlsx, pdf, png, jpg, jpeg, etc) in document library. SharePoint search is set up in our server which crawls the data every half an hour.

Case 1 :

When any document (of type docx, xlsx, pdf) is added in document library, unique Document ID generated for document. When I clicked on that link, that document is either opened (if client application installed like pdf, office application) or downloaded.

Case 2 :

But when I added documents of file types png, jpg, jpeg or mpp in document library and clicked on Document ID, it works same as Case 1. After half an hour search crawls the site. When I clicked again on Document ID link, it opens the display form of that document instead of opening or downloading the document. But the Case 1 is still working even after crawling happens.

I search for the issue in internet and found below article in msdn :

Document ID Lookup Behavior

 SharePoint Server 2010 takes a two-part approach when the document ID service looks up document IDs to provide the best balance of document IDs that work immediately and those that work across broad scopes:
  • Search. Find an item across any location that belongs to the current search scope. Search generally performs better as a cross-list query. However, search is only as reliable as its last index. Therefore, if an item was added but has not yet been indexed by search, it does not appear in search results. Additionally, if an item was moved since the last time it was indexed by search, then the old (and now broken) URL appears in search results.
  • Lookup specific to the ID provider. When an item cannot be retrieved by using search (for example, if it has not been indexed yet), SharePoint Server 2010 calls back to the document ID provider and allows it to use its own lookup logic. This enables providers who want to use IDs that work before search indexing is run on the last items to look them up. The provider determines whether to perform lookups in this way and what the most effective logic is for doing so.

After reading above statement it clear that SharePoint Search is not properly indexing the document of file types png, jpg, jpeg, mpp.

You can read below article to know more about default File Types supported  by SharePoint Search :

SharePoint Search 2013 File Types


To solve this issue, we have to go SharePoint server and follow below steps:

  1. Open Central Administration -> Application Management .
  2. Click on “Manage service applications
  3. Open Search Service Application
  4. On left section, under Crawling section click on File Types. Here you will see all file types which SharePoint Search understands and crawled properly.
  5. Click on “New File Type” and add all extensions one by one without any dot.
  6. Now click on Content Sources and start Full Crawl on your content source which is created for your web application.
  7. Once Full Crawl completed, check those documents which are failed to open earlier. When you clicked again on Document ID link, they will work as expected without redirecting to display form.

Note : Repeat above steps for other file types which are facing similar issue.

References :

SharePoint : Get User’s login name from claims encoded value

There are sometimes scenarios where we have to get user’s login name and we have only claims encoded value (like this i:0#.w|domain\username or i:0#.f|membershipprovider| In SharePoint 2013 / 2010, there is SPClaimProviderManager class available which can decode the claims and provide user’s login name.

I have created a method, which accepts claims encoded value as parameter and returns user’s login name (only if claims are resolved properly).

private string GetUsernameFromClaim(string claimsEncodedUsername)
 SPClaimProviderManager mgr = SPClaimProviderManager.Local;
 if (mgr != null)
 if (SPClaimProviderManager.IsEncodedClaim(claimsEncodedUsername))
 // return the normal domain\username without any claims identification data
 return mgr.DecodeClaim(claimsEncodedUsername).Value;
 catch (Exception ex)
 return claimsEncodedUsername; // Or just return the original username.

 // Return the original username value if it couldn't be resolved as a claims username
 return claimsEncodedUsername;

Note : Add namespace “Microsoft.SharePoint.Administration.Claims” to use above class.

Issue in SharePoint Folder name with apostrophe ( ` ) and Launch Dialog property of List / Library

In SharePoint list / library items are created for storing the data. Generally user wants a granular structure for maintaining data and for this they creates folder and place their items. Now, if “Launch Dialog” box property is set to “Yes” for this list / library, then details are shown in dialog box. Now if folder name contains apostrophe ( ‘ ) then JavaScript fails in SharePoint and dialog box will not open for all items which are placed inside that folder.

In SharePoint, certain characters are not accepted while creating folder names : ~ ” # % & * : < > ? / \ { | }.
But apostrophe ( ‘ ) is accepted by SharePoint in folder name, and above mentioned issue will applicable only when launch dialog property of list / library is enabled.

If dialog box of items are not opening properly, then look for all parent folders of that item and check whether those folder contains apostrophe ( ‘ ) or not. If yes, then rename that folder name by removing apostrophe.

Using third party DLL in SharePoint 2013 solutions

When working with SharePoint solutions, sometimes there is a requirement to use third party DLLs in SharePoint solutions (Eg. Telerik, CuteUploader, etc). Here we will discuss the steps to use third party DLLs in SharePoint:

  1. Copy the DLL in bin directory of SharePoint web application.
  2. Open Visual Studio 2012/2013, create SharePoint empty project as farm solution.
  3. Add visual webpart in this project.
  4. Add reference of third party DLL in this project.
  5. After adding the reference of the DLL, deploy the project in SharePoint environment.
  6. Register the tag of third party DLL in visual webpart ascx page.
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
  7. Place the controls of third party DLL in visual webpart.

Note : Do not register the tag of third party DLL in visual webpart just after adding the reference (Step 4). First deploy the project otherwise the *.g.cs file will not get generated.

Quota template for the site collection in SharePoint

The Quota template means to Lock or Unlock the SiteColletion for the user. It can be temporary or permanently used to prevent the access of the SharePoint site to the end users.

How to configure lock

These are the following steps to enable lock in sitecollection of SharePoint.

  • Go to Central Admin then click on Application Management
  • In the Site Collection section, click on Configure quotas and locks
  • Then Look for your site collection should be selected. (if not, then change to your site collection.)
  • In Site Lock Information section, select one of the following options
    • Unlock
    • NoAdditions
    • ReadOnly
    • NoAccess

Types of Locks in SharePoint

  • UnLock:  to unlock the site collection and make it available to users
  • NoAdditions: to prevent users from adding new content to the site collection. Updates and deletions are still allowed
  • ReadOnly: to prevent users from adding, updating, or deleting content
  • NoAccess: to prevent users from accessing the site collection and its content. Users who attempt to access the site receive an error.


To lock or unlock a site collection by using Windows PowerShell

The command to set lock using powershell is as follows

Set-SPSite -Identity “<SiteCollection>” -LockState “<State>”