Thursday, October 31, 2013

Disabling mobile page redirection in SharePoint 2013

SharePoint 2013 is supported for mobile devices and it will detect the request from mobile devices according to the request it will changes the URL of the page automatically. Mobile view is different from the desktop view in SharePoint. SharePoint is having complete different controls for mobile pages.

We are having Microsoft.SharePoint.MobileControl namespaces for mobile pages which inherits from System.Web.UI.MobileControls namespace. Whenever mobile device request is detected, it will redirected to mobile devices optimized version pages. By default these pages will be located in “_layouts/mobile” folder. By default the team site redirects mobile home page “_layouts/mobile/mblwp.aspx”. We can customize the home page for the mobile devices.

We can restrict redirection for mobile pages, by adding the below lines in web.config file System.web for SharePoint web application

<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile,            Version=, Culture=neutral, PublicKeyToken=d04e4d2a43f43d3e"/>

Wednesday, October 30, 2013

SharePoint custom workflow Error – This view cannot be displayed because the number of lookup and workflow status columns exceeds the threshold”

While working with SharePoint custom coding on lists, I got an error saying that “This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold..”

After googling in to the issue, I have found the solution in this post. We can see this problem due to lookup columns value exceeds the SharePoint environment configuration value. When tis error occurs, SharePoint web services will refuse to return the documents. By increasing “List View Lookup Threshold” value, we can fix this error.
We can increase the limit in SharePoint central Administration by using following steps,

Navigate to application Management in SharePoint Central Administration and click on “Manage Web Applications” link.

Select the web application to increase threshold value, Click on “Resource Throttling” in General Application Settings in the ribbon.

In List View Lookup Threshold” section we can specify the maximum number of lookup that Specify the maximum number of Lookup, Person/Group, or workflow status fields that a database query can involve at one time. Change the value to bigger and click on OK to save the settings.

Tuesday, October 29, 2013

Cache profiles in SharePoint

SharePoint adds caching mechanism with output caching that is available in ASP.Net 2.0. It contains Cache profiles that we can name and apply the pages and page items, content types and levels of scales in the development environment.

By using cache profiles we can control the quality level of the output caching in SharePoint site. It will allow or disallow site owners to choose their cache profiles. We can manage the user access permissions to SharePoint depending on the access to the site. Output cache renders the page, same way for users in same right. After creating and deploying the cache profile, any change that affects the cache profile will affects all the content access of the profile.

To enable output cache settings,
Navigate to Site Settings menu and click on Site Collection Output cache in Site Collection Administration section

In the Output Cache Settings page, check Enable output cache check box to enable output cache.

Select cache profile for anonymous from Anonymous Cache Profile list. This applies for anonymous users access for a site in Site Collection. To choose authenticated users from Authenticated Cache profile list. This will apply for authenticated users to access in a site in the Site Collection. To display additional cache information on the site collection pages that including the date and time of the page rendered earlier select Enable debug cache information on pages.

To create new caching profiles,
Navigate to Site Setting menu in SharePoint site. Click on Site collection cache profiles in Site Collection Administration.

Click on New to Create new cache profile.

Provide Title, Display Name, Description for Cache profile in Title, Display name Display Description columns. To ensure that all items in the cache are security trimmed check “Perform ACL Check” check box. To enable the cache, check “Enabled” check box. Enter Duration to specify the number of seconds to keep the cached version available. Check for changes will validates the page requests that the site has and to flush the cache. If we unchecked this system will not check for the updates on the sites.

Vary by custom parameter, Vary by HTTP Header and Vary by User Rights will specifies the values described in the ASP.Net cache policy. By selecting Vary by User Rights, we can ensure that users will have effective rights on the SharePoint site that having on the cached page. Select any value in Cacheability drop down  Select the policies to allow the authenticated users and page layout designers to apply authenticated scenarios. Check “Allow Writers to View Cached Content” to not allowing people with edit rights to cache their pages.

Thursday, October 24, 2013

SharePoint SEO and Robots.txt

Many of public sites developed in SharePoint that are configured to allow anonymous access with restriction that should not be indexed by any search engines. We can prevent that by placing robots.txt file in the root of our SharePoint site.

Robots.txt file is text file that we can place in SharePoint site root level to indicate the search engines that should not crawled or indexed. It is not a mandatory rule for search engine to follow Robots.txt instructions but generally search engines are designed to obey robots.txt commands.

Robots.txt file location should be in the main directory of site that should be easily available for search engines. Because search engines should not search for the entire site for robots.txt file.  They look main directory of site, if it is not find there, then it will assume that current site will not have any robots.txt file. So that it will index everything in the site.

To create a robots.txt file, create a text file with following kind of text,
User-Agent: *
Disallow: /_Layouts/
Disallow: /SiteAssets/
Disallow: /Lists/
Disallow: /_catalogs/
Disallow: /WorkflowTasks/

Here “User-agent” means the section that applies all robots and “Disallow” tells robot that should not index in the site. Save the file as “robots.txt” .Add file in root of the site by using SharePoint designer. Open designer and add the file in All files tab. By adding the file in All files tabs robots.txt file will be located in root site.

To add robots.txt file to the site, navigate to Application Management in SharePoint central Administration, Define managed path for the web application to configure.
In the Path text box, provide the URL as “/robots.txt” and type as Explicit inclusion. Click on Ok to save the settings.

Do IISRESET. If we have permissions problem, Provide read permissions for “Everyone” to robots.txt file.
We can add robots.txt file to a site using following Power Shell commands.

$file = []::ReadAllBytes("robots.txt full path");                                          
$siteToAddFile = Get-SPSite "Site to add the robots.txt"; 
$siteToAddFile .RootWeb.Files.Add("robots.txt", $ file, $true);  

Wednesday, October 23, 2013

Sharing with Everyone in SharePoint 2013

Sharing with everyone option will help users to share without depending on permissions. That will be applicable for “All authenticated users” and “all users in tenant” in the sense “Everyone” and “Everyone excluding external users”.

By default sharing option will be available for SharePoint 2013 site created using existing template. But when we create a site using site template or a solution, try to share the site we’ll get an error saying that “This web template required that certain features be installed, activated and licensed. The following problems are blocking application of the template:” 

After googling some time i have found the solution from office blog URL. All authenticate users is now Everyone. So these settings will not be automatically updated. We have to activate a feature to fix the issue. To activate the feature we need to run the Power Shell commands below,

$siteURL= “URL Of the Site Collection to activate the feature” 
$site = Get-SPSite $ siteURL$site.Features.Add([System.Guid]"10F73B29-5779-46b3-85A8-4817A6E9A6C2")

Here 10F73B29-5779-46b3-85A8-4817A6E9A6C2 is the GUID of the feature to activate.

Tuesday, October 22, 2013

Suggested Content Browser Locations in SharePoint 2013

In SharePoint Site collection, we can configure “Suggested Content Browser Locations” to access the directories easily. When we configure these locations, we can see them as drop down to the users when we select the content SharePoint. To view this link, we need to activate the publishing feature.

We can configure suggested content browser location at site collection level. To configure suggested content browser locations, navigate to Site Settings, in the Site Collection Administration section, click on “Suggested Content Browser Locations” link.

We can see the list. Click on new item to create new suggested location link.

Enter Display Name, URL and Description in the list item.

To check the suggested content browser location navigates to any page, edit the page. Select Insert option.

In the Select Asset dialog, We can see the Suggested link drop down as shown the image below.

So that we can access the suggested location easily by configuring the Suggested Content Browser location.

Friday, October 18, 2013

Get SharePoint feature ID using IE developer tool bar

We can get many errors in SharePoint referring the feature GUID. It is not possible to check quickly what associated feature with that GUID is. We can get the feature GUID using IE developer tool bar.
To get the GUID, navigate to site collection features page (Site Settings -> Site Collection features)

Press F12 button, we can see the IE developer tool bar. Select the feature ‘Activate’ button on any feature that we want to check. We can see “ID” value in HTML as shown in the image. That is features GUID.

To check the current GUID is correct or not, Open SharePoint Management shell and enter following PowerShell command.

Get-SPFeature |  Where-Object {$_.Id -eq “GUID“}

Here GUID is id of the feature. We can see feature display name, ID and Compatibility Level as shown the image below.

Thursday, October 17, 2013

Enable auto approval in SharePoint community site

We can enable auto approval in SharePoint community site to get access automatically without request approval. We can enable the auto approval for only community site; it will not apply membership for any group. Generally auto approval is suitable for open communities without having restrictions.  So whenever we want to configure auto approval, we have to manage the permissions. If we have auto approval in SharePoint community site, whenever new user clicks on Join button, we can get an email. We can manage the permissions of the user in People and Groups settings on Site settings page

To enable auto approval, Click on Community Settings link Community site home page, Community tools WebPart.

We can see “Enable auto-approval” check box (We can see this option only for root site collections. This will not be available for sub sites)

Click on ok to save the settings.

Tuesday, October 8, 2013

Adding blog to a SharePoint site instead of creating new site

It’s nice trick from Steve Mann. In SharePoint to create new blog site we have to create a site in site or site collection using blog template. Instead of adding new blog site, we can add the blog to existing site by using a simple command in SharePoint 2013 by enabling blog content feature.
To add a blog to existing site, open SharePoint management shell and enter following command below,

Enable-SPFeature -identity "BlogContent" -url <Site URL>

Here Site URL is URL of the site.

After activating the “Blog Content” feature we can see the blog related items in the SharePoint site. We can check the webparts with blog related content as shown in the image below.

Friday, October 4, 2013

Add BCC to SharePoint designer workflow

In SharePoint designer 2010, workflow to send emails, we cannot find BCC (Blind Carbon Copy) column. We can see only To and CC (Carbon Copy) options with Subject and Body. 

If we have the requirement to include users in BCC, we can do that by using the steps below,
Complete the Send Mail activity and click on OK. Select Email task in the workflow, click on “Advanced Options” on the top of the ribbon.

We can see “Send an Email Properties” window. In BCC column we can add users to include BCC. Browse users in workflow click on (…) on BCC Column. Add users and click on OK. Click on Ok to close “Send an Email…” window.

Save and publish workflow.

Thursday, October 3, 2013

Enable Videos in SharePoint 2013

This is basic thing in SharePoint 2013. We can enable videos by activating an in-built feature in Site collection level. To get video support in SharePoint 2013, we have to activate the Video and Media feature in Site Collection level. To do that,

Navigate to Site Settings and select Site Collection features in Site Collection Administration section.

Check for “Video and Rich Media” feature and activate that feature.

By activating the feature we can see “Assets Library” to add rich media assets, like image, audio and video files etc... to Site collection.