Archive for November, 2014


The Distributed Cache service provides caching features in SharePoint Server 2013. The microblog features and feeds rely on the Distributed Cache to store data for very fast retrieval across all entities. The Distributed Cache service is built on Windows Server AppFabric, which implements the AppFabric Caching service. Windows Server AppFabric installs with the prerequisites for SharePoint Server 2013. The Distributed Cache service provides in-memory caching services to several features in SharePoint Server 2013. Some of the features that use the Distributed Cache service include:

  • Newsfeeds
  • Authentication
  • OneNote client access
  • Security Trimming
  • Page load performance

In SharePoint Server 2013, there are several caches that exist, all of which depend on the Distributed Cache service.

Different caches that depend on the Distributed Cache service as indicated in the following table:

Name Cache Name Description
Login Token Cache DistributedLogonTokenCache
Feed Cache DistributedActivityFeedCache This cache stores activities and conversations for use by the feeds on a user’s My Site.
Last Modified Time Cache DistributedActivityFeedLMTCache This cache stores time stamp information for all Feed Cache entities.
OneNote Throttling DistributedBouncerCache
Access Cache DistributedAccessCache
Search Query Web Part DistributedSearchCache
Security Trimming Cache DistributedSecurityTrimmingCache
App Token Cache DistributedServerToAppServerAccessTokenCache
View State Cache DistributedViewStateCache
Default Cache DistributedDefaultCache This cache can be used by any feature.

The microblog features and feeds rely on the following two caches: the Last Modified Time Cache and the Feed Cache.

  • Feed Cache: The Feed Cache stores recent activities and recent conversations for all entities.
  • Last Modified Time Cache: The Last Modified Time Cache is used to determine the last modified time for all items in the Feed Cache.

Source: Overview of microblog features, feeds, and the Distributed Cache service in SharePoint Server 2013.


Useful API reference of the most frequently used types and objects implemented in .NET object model and at least one client programming model. .NET client-side object model (CSOM), JavaScript object model (JSOM), and/or REST.


CSOM  JSOM and REST API index part 2

CSOM  JSOM and REST API index part 3

CSOM  JSOM and REST API index part 4

Ref: SharePoint 2013 .NET Server, CSOM, JSOM, and REST API index


When you create a new web part page in SharePoint, its left navigation column becomes empty. The reason for this is that the left side navigation is defined in the Master Page using the “PlaceHolderLeftNavBar” content place holder and templates for Web Part Pages shipped with SharePoint and overrides this content place holder and deletes its content, thus displaying empty left navigation.

The solution for this is to change the page so it will not override the menu place holder, but inherit it from the Master Page. The place holders we are interested in are:


  1. There is this tag that needs to be deleted or commented (this one hides the left nav):

    tag for deleted or commented

  2. Delete only this tag since this is what overrides the default nav coming from the master page.


  3. Leave this tag as it is, if this is deleted (as said in other posts) it leaves a blank row on top of the left nav which is not what you would want.

    content place holder

  4. Save the file.

You will get a warning saying you are about to customize the page. Just go ahead and open that web part again. It should have that good left navigation.


This is a very common issue faced by 9 out of 10 SharePoint developers. The custom site Logo is not reflected on the Web Part Page and hence the default logo is seen as shown in the screenshot:

Home Page

sharepoint home page

NewTestPage (WebPartPage)

new test page in sharepoint

  1. Go to the Web part (NewTestPage) page.
  2. Click on the “Page” tab at the top, click on the “Title Bar Properties” at the right (in the ribbon).

    page title bar

  3. In the Image Link section on the right, paste in the image URL:

    image url

  4. Click OK.

Out Page: Web part Page

new test page


In this blog we explore to retrieve large number of items with a better performance we can either user SPQuery or PortalSiteMapProvider Class. Read more with examples. Retrieving large number of items from SharePoint List.

If you have to retrieve a large number of items and also need a better performance then you should use one of the method below:

  • Using SPQuery
  • Using PortalSiteMapProvide

Let’s see the example for both the method


  1. using (SPSite CurrSite = new SPSite(SPContext.Current.Web.Url))
  2. {
  3.    using (SPWeb CurrWeb = CurrSite.OpenWeb())
  4.    {
  5.        SPQuery curQry = new SPQuery();
  6.        curQry.Query = “<Where><Eq><FieldRef Name=’Dept’/> <Value Type=’Text’>Sharepoint</Value></Eq></Where>”;
  7.        curQry.RowLimit = 100;
  8.        SPList curList = CurrWeb.Lists[“Dept”];
  9.        SPListItemCollection curItems = curList.GetItems(curQry);
  10.        foreach (SPListItem curItem in curItems)
  11.        {
  12.            string ResultTitle = curItem[“Title”].ToString();
  13.        }
  14.    }
  15. }


The Class includes a method called GetCachedListItemsByQuery that retrieves data from a list based on an SPQuery object that is provided as a parameter to the method call.

The method then looks in its cache to see if the items already exist. If they do, the method returns the cached results, and if not, it queries the list , store the results in cache and returns them from the method call.

  1. //Get Current Web
  2. SPWeb curWeb = SPControl. GetContextWeb(HttpContext.Current);
  3. //Create the Query
  4. SPQuery curQry = new SPQuery();
  5. curQry.Query = “<Where><Eq><FieldRef Name=\’Category\’/><Value Type=\’Text\’> Sharepoint </Value></Eq></Where>” ;
  6. //Get Portal Map Provider
  7. Portal SiteMapProvider ps = PortalSiteMapProvider.WebSiteMapProvider;
  8. PortalWebSiteMapNode pNode = TryCast (ps.FindSiteMapNode (curWeb. ServerRelativeUrl), PortalWebSiteMapNode);
  9. //Get the items
  10. Pltems = ps.GetCachedListItemsByQuery (pNode, “Dept”, curQry, curWeb);
  11. //Enumerate all resulting Items
  12. foreach(PortalListItemSiteMapNode curItem in pItems)
  13. {
  14.    string ResultItemTitle = curItem[“Title”]. ToString();
  15. }

Using the keyboard shortcut is always effective that using the mouse, especially if the graphical designer of the page moved and you are unaware of that. Keyboard shortcuts can help you find what you want and where you want to go.

To use the keyboard shortcut combinations, you must press several keys at the same time. After pressing certain key combination you must release the keys before pressing another.

You can see which key is assigned to the options by pressing key Alt+ tab.

 Shortcuts are shown in below screen grabs displayed as in black box.


For example


In this blog, we have an overview on keyboard shortcut keys for SharePoint 2013.


_spPageContextInfo variable provides few properties which will be useful in JavaScript and client object model code.

_spPageContextInfo is a  JavaScript/jquery context variable, which will rendered for each SharePoint page. _spPageContextInfo holds few proprieties which will be useful in JavaScript/jquery and client object model code. If you want to know the properties of _spPageContextInfo, go to view page source and find text with “_spPageContextInfo”.

When It will be useful

When we are making any ajax calls, we might need the server URL dynamically. In this case we can use _spPageContextInfo.siteAbsoluteUrl property.

If you want to know the current SharePoint List GUID, use _spPageContextInfo.pageListId.

Even it has more properties also(which are self explanatory). We can use them according to the requirements.

Sample Code

  1. $.ajax({
  2.          beforeSend: function (request) {
  3.             request.setRequestHeader(“Accept”“application/json;odata=verbose;charset=utf-8”);
  4.       },
  5.       url: _spPageContextInfo.siteAbsoluteUrl +“/_api/search/query?querytext='” + request.term + “*’&sourceid=’b09a7990-05ea-4af9-81ef-edfab16c4e31’&rowlimit=’20’&selectproperties=’FirstName,AccountName,PictureURL,SipAddress,PreferredName,Country,City'”,
  6.                 dataType: “json”,
  7.                 success: function (data) {
  8.                     response($.map(data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results, function (item) {
  9.                         return {
  10.                             fields: getFields(item.Cells.results)
  11.                         }
  12.                     }));
  13.                 },
  14.                 error: function (data) {
  15.                     alert(‘search error’);
  16.                 }
  17.             });
  18. _spPageContextInfo Object Properties found for SharePoint 2013 application:
  19. alertsEnabled: false
  20. allowSilverlightPrompt :“True”
  21. clientServerTimeDelta :-8980
  22. crossDomainPhotosEnabled: false
  23. currentCultureName: “en-US”
  24. currentLanguage: 1033
  25. currentUICultureName: “en-US”
  26. layoutsUrl: “_layouts/15”
  27. pageListId:  “{df5e2d45-ad0b-4608-a813-ded6a97511db}”
  28. pagePersonalizationScope:  1
  29. serverRequestPath:  “/sites/ SharepointSite /Lists/ custom/ custom.aspx”
  30. siteAbsoluteUrl: http://svr:2525/sites/ SharepointSite &#8220;
  31. siteClientTag: “0$$15.0.4433.150615.0.4433.1506
  32. siteServerRelativeUrl; “/sites/ SharepointSite “
  33. systemUserKey: “i:0).w|s-1-5-21-2086049…90378103-3194450012-500”
  34. tenantAppVersion: “0”
  35. userId: 1
  36. webAbsoluteUrl: http:// svr:2525/sites /sites/SharepointSite&#8221;
  37. webLanguage: 1033
  38. webLogoUrl:“_layouts/15/images/siteicon.png”
  39. webPermMasks: Object { High=2147483647, Low=4294967295}
  40. webServerRelativeUrl: “/sites/ SharepointSite “
  41. webTemplate: “1”
  42. webTitle : ” SharepointSite “

In this blog, let us discuss how to upload a custom list template and about creating a list based on this custom template, in SharePoint 2013, using PowerShell.

# Adding the PowerShell Snapin
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
# Get the SiteURL
$site = get-spsite(“http://SiteCollectionURL/&#8221;)
# Get the root web
$web = $site.RootWeb
# Get the list template gallery
$spLTG = $web.getfolder(“List Template Gallery”)
# Get the list template gallery Collection
$spcollection = $spLTG.files
# Get the custom list template file
$Templatefile = get-item “C:\Custom_list_template.stp”
# Add the custom list template file to gallery
$spcollection.Add(“_catalogs/lt/Custom_list_template.stp”, $Templatefile.OpenRead(), $true)
Write-Host “Custom Template Uploaded to List Template Gallery Successfully”
Write-Host “Creating the List based on the Template”
# Get the custom list templates
$CustomlistTemplates = $site.GetCustomListTemplates($web)
#Create the custom list using template
$web.Lists.Add(“Custom_list”, “Custom list”, $CustomlistTemplates[“Custom_list_template”])
Write-Host “Based on the template List Created


The web site uses a large number of user controls hard coded across twenty-odd page layouts–a big no-no. While we’ve matured as a dev. team since this site launched and now fully appreciate the value of web parts and a small set of key page layouts, unfortunately the site is live as-is.

From a production support perspective we’re still working on the site and adding new user controls here and there. This shouldn’t be problematic but MOSS, in its infinite wisdom, limits the number of user controls on a page and fails when that limit is reached.

Server Error in Application

When developing large portals, it can often be a mistake. associated with exceeding limit inclusion in external objects, such as pages, .ascx files.

This problem can easily be corrected by editing the Web.config file. For this limit corresponds to the parameter DirectFileDependencies.

If you insert more than 10 user controls in a masterpage, you might get an error similar to this:

The page ‘/path/somefile.master’ allows a limit of 11 direct dependencies, and that limit has been exceeded.

You can easily increase that limit as it is actually set in your sharepoint web.config:

Steps edit web.config

  1. Browse to C:\inetpub\wwwroot\wss\VirtualDirectories\

    Browse Folder

  2. Open the folder corresponding to your Sharepoint website.
  3. Edit the file web.config
  4. Do a search for “safemode“.
  5. Change the property DirectFileDependencies from 10 to a value your choice.
  6. Do an iisreset command and you’re done!

< SafeMode MaxControls = “200” CallStack = “true” DirectFileDependencies = “20” TotalFileDependencies = “50” AllowPageLevelTrace = “false” >

The solution is to simply increase the value to the desired value.


SharePoint 2013 offers a vast variety of out-of-the-box site templates. One of the success factors of your SharePoint deployment is choosing the most suitable site template that meets your business needs.

Apart from all the site templates included with SharePoint 2010, SharePoint Server 2013 has some new site templates.  A number of site templates are available in SharePoint 2013. Site templates are grouped into categories such as Collaboration, Enterprise, and Publishing.

Apart from all the site templates included with SharePoint 2010, SharePoint Server 2013 has some new site templates.

Title Description
App Template A base template for app development. It provides
the minimal set of features needed for an app.
App Catalog Site A site for sharing apps for SharePoint and Office
Developer Site A site for developers to build, test and publish
apps for Office.
Academic Library The Academic Library template provides a rich
view and consumption experience for published
content and management. Authors populate
metadata and apply rules at the time of
publishing, such as description, licensing,
and optional rights management.
(IRM). Visitors of the site can search or browse
published titles and add authorized selections
to their collection to consume, subject to the
rights and rules applied by the author.
The site provides an IRM-capable document
library, a publishing mechanism for authors
to publish documents, detailed views for
each document, a check-out mechanism,
and related search capabilities.
eDiscovery Center A site to manage the preservation, search,
and export of content for legal matters
and investigations.
eDiscovery Case This template creates an eDiscovery case.
Users create locations where they can
preserve or export data.
Storage And Social SharePoint Portal Server Personal Space This web template defines a minimal
Personal Space with both Social and
Storage features for an individual
participating on a SharePoint Portal.
Storage Only SharePoint Portal Server Personal Space This web template defines a minimal
Personal Space with Storage features for
an individual participating on a
SharePoint Portal.
Project Site A site for managing and collaborating
on a project.
This site template brings all status,
communication, and artifacts relevant to
the project into one place.
Product Catalog A site for managing product catalog data
which can be published to  an internet-facing
site through search. The product catalog
can be configured.
to support product variants and multilingual
product properties. The site includes admin
pages for managing faceted navigation for
Community Site A place where community members discuss
topics of common interest. Members can
browse and discover relevant content
by exploring categories, sorting discussions
by popularity or by viewing only posts
that have a best reply. Members gain
reputation points by participating in the
community, such as starting discussions
and replying to them, liking posts and
specifying best replies.
Community Portal A site for discovering communities.