Skip to main content


Showing posts from 2015

SharePoint : Update URLs after resotring a content DB of hostnamed site collections

To change or update URLS after resotring a content DB of hostnamed site collections, use
stsadm -o renamesite -oldurl -newurl

You only need to rename the root hostnamed site collection. It will reflect on the other HNSC starting with the same URL.

If you try using Set-SPSiteURL on an HNSC with  same starting url, you will get the error : Could not perform this operation on the site collection To add a URL for this site collection add a URL to the root host-named site collection at At line:1 char:1

Correct way to handle exception for Get-SPWeb and Get-SpSite SharePoint PowerShell

Catch block does not work correctly for exceptions from get-spweb and get-spsite without the
-ErrorAction Stop parameter.

 This code will not print "in catch block"

 try{Get-SPWeb 'wrong url'} catch { Write-Host "in catch block" }

 correct usage : try{Get-SPWeb 'wrong url' -ErrorAction Stop } catch { Write-Host "in catch block" }

Access Host Web from App web in SharePoint hosted app - Office 365

Here is a snippet to save your day.
There are many snippets out there showing you how to do cross domain calls, but none of them complete.

Here is a sample to access host web components from a SharePoint hosted app or add in.
Keywords: SharePoint, access host web, sharepoint online, JSOM, CSOM, SharePoint hosted app, Office 365.

'use strict'; //URLs var hostweburl; var appweburl; var context; var appContextSite; var factory; var context = SP.ClientContext.get_current(); var appContextSite; var rootweb ; var roleDefinitions ; (function () { $(document).ready(function () { hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl")); var scriptbase = hostweburl + "/_layouts/15/"; $.getScript(scriptbase + "SP.Runtime.js", function () { $('#message').append(" Getting Scripts.. "); $.ge…

Azure Active Directory GraphClient AuthorizationException

Error : Microsoft.Azure.ActiveDirectory.GraphClient.AuthorizationException Insufficient privileges to complete the operation


Under Configure
under Permissions to other applications

Add application - Windows Azure Active Directory
Give the following permissions

Read directory data
Sign in and read user profile

Stack Trace : 
Microsoft.Azure.ActiveDirectory.GraphClient.AuthorizationException was unhandled by user code
  Message=Insufficient privileges to complete the operation.
  ErrorMessage=Insufficient privileges to complete the operation.
       at Microsoft.Azure.ActiveDirectory.GraphClient.ConnectionWrapper.InvokeNetworkOperation[T](Func`1 action)
       at Microsoft.Azure.ActiveDirectory.GraphClient.ConnectionWrapper.DownloadData(String address, WebHeaderCollection additionalHe…

SharePoint : Access Denied when crawling mysites

Error Message: Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled.

Solution 1: Add backconnection host names in the registry

under HKLM\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
Add a Multi-String Value with name "BackConnectionHostNames".
Add the host names for the sites that are on the local server.

Solution 2: Disable loop-back check on the server  ( or add host name to

Under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa"
Create a new 32bit DWORD value "DisableLoopbackCheck" with value as 1

Solution 3: Give your content access account "Retrieve People Data for Search Crawlers" permission on the user profile service application.

Solution 3 : Verify that…

SharePoint 2013 web application authentication fails

Error: SharePoint 2013 web application authentication fails, prompts for credentials 3 times and displays blank page.

Kernel Mode Authentication is not supported in SharePoint Products. I would suggest turning this off. If you want this enabled, there is a workaround s - 

Change the ApplicationHost.config file to have the bit
<windowsauthentication enabled="true" useapppoolcredentials="true">< /windowsauthentication>

6 Things to eliminate cultural slang in English documents

Tips for writing or enhancing formal documents : From my personal observations.
English is a universal language and can vary quite a bit among different cultures. Here are a few styles that I have seen in documents written by Indian authors and some tips on make your document eliminate those cultural slangs.

Certain words are used more commonly in speaking where the body language of the speaker assists in conveying the real intention of the words usage. A tip would be write as you normally would and check for such common words and see if it is the right word for the sentence.
Examples below. 
Good: Check if the word good accurately describe the situation that you are trying to convey. It is common to use the term good, but it might not have the accuracy in conveying the message. E.g. with good training you might have meant that the training was intensive of fast paced or effective or thorough, however the reader will not get the same meaning. 
Small: Similar to the word good above.

SharePoint : Failed to load dependency assembly

A windows update broke search in SharePoint.

We could not resolve the error in the server. We have to recreate search service in a new server.
You are luck if your search topology has redundancy.

Errors in ULS:

AssemblyReflector : Failed to load dependency assembly in load context and in load from context. Assembly: BihConsumerInterop System.IO.FileNotFoundException: Unable to find the specified file.

Errors in Process Monitor

HKU\S-1-5-21-494056553-2953882651-1462924595-7389\Software\Microsoft\.NETFramework NAME NOT FOUND HKU\S-1-5-21-494056553-2953882651-1462924595-7718_Classes\CLSID\{BDEADF26-C265-11D0-BCED-00A0C90AB50F}\InprocServer32 NAME NOT FOUND
HKLM\SOFTWARE\Microsoft\.NETFramework\JitLockWrite NAME NOT FOUND

SharePoint 2013 : Error while accessing MySite after changing MySite URL

Error while accessing MySite after changing MySite URL.

Solution :
Verify permissions on mysite service application for the account used to change the URL.
Re enable the service connection to the webapplication.

ULS Error:

Exception occurred loading user profile (/default.aspx): Microsoft.Office.Server.UserProfiles.UserProfileApplicationNotAvailableException: UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.GetRawPartitionID has null proxy  
 at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.GetRawPartitionID(SPServiceContext serviceContext)  
 at Microsoft.SharePoint.Portal.WebControls.ProfilePropertyLoader.get_CurrentPartitionId()  
 at Microsoft.SharePoint.Portal.WebControls.ProfilePropertyLoader.OnInit(EventArgs e).

SharePoint : Workflow stuck at a stage, on a list with unique permissions

In SharePoint 2013, workflow runs with the users permissions unless it has an app step with elevated permissions. If your list has unique permissions, ensure that your workflow history list and task list have write permissions for the user.

Another item to check for are steps in the workflow where the user do not have permissions to do. One instance is if the user has no delete access on the list but there is a step in the workflow to delete an item in the list.  This was not an issue in SharePoint 2010 as the workflow was running as system account.

Also, do not make your workflow to depend on or read the last modified date on the item. Because the workflow will change it.

SharePoint online - Update timezone for a sitecollection via CSOM

Here is a snippet to update timezone for a site-collection via CSOM

Web web = clientContext.Web; RegionalSettings webRegionalSettings = web.RegionalSettings; clientContext.Load(web); clientContext.Load(webRegionalSettings); Microsoft.SharePoint.Client.TimeZone currentTimeZone = webRegionalSettings.TimeZone; clientContext.Load(currentTimeZone); clientContext.ExecuteQuery(); //Get the current site TimeZone ConsoleLogger.LogMessage(LogLevel.Verbose, "Current TimeZone: " + currentTimeZone.Id + " - " + currentTimeZone.Description); //Get web timezones TimeZoneCollection webTimeZones = webRegionalSettings.TimeZones; clientContext.Load(webTimeZones); clientContext.ExecuteQuery(); // 76 (UTC+10:00) Canberra, Melbourne, Sydney Microsoft.SharePoint.Client.TimeZone newTimeZone = webTimeZones.…

SharePoint 2013 : Unique edit permissions not working

An error message "Server unable to process the request" is displayed when a user with unique permissions on a list tries to update a list item.

This issue sometimes occurs in a Site Collection, however the exact error is unknown.

A workaround is to create a permission level on the site collection which consists of the following:

User remote interfaces (Use SOAP, Web DAV, or SharePoint Designer 2010 interfaces to access the Web site)Open(Open a Web site, list, or folder to access items inside that container). Assign this new permission level at site collection and site level to the users requiring unique permissions.
The users will now be able to edit the list items.

Strange IE Mailto link error - Sys.InvalidOperationException

I am getting a strange error in IE. There is an A tag with a mailto link. It works fine for one email ID but fails for multiple email IDs.
End user uses IE 9 with Win 7 SP1
Tested in IE 11 with Win 7 SP1 too.

This happens only in their environment. The site is an Office 365 SharePoint site. Can see that the link instead of just opening the email client does a post back and has this error message :

Sys.InvalidOperationException: Cannot access

Has anyone come across this error?

Profiler log goes like this :


Evaluating SharePoint requirements

SharePoint is a productivity tool for information management and discovery. Any requirement that does not tie back to this rule has to be re-evaluated.

This is my personal opinion.

A few more of my quotes.

Never hide anything from your doctor, lawyer or SharePoint consultant. It will cost you your health, wealth, or both.

What happens in SharePoint stays in SharePoint.

Unable to mount windows 10 technical preview ISO

Problem : Unable to Mount windows 10 ISO

Solution: execute this command from an elevated command prompt. Now you should be able to mount the ISO.

fsutil sparse setflag "File_Name" 0

fsutil sparse setflag "Windows10_TechnicalPreview_x64_EN-US_10041.iso" 0

I was trying to mount the downloaded copy of windows 10 technical preview and it was giving error.
Finally the above command saved me.

Reference :

Key :  Problem mounting ISO on Hyper-v
Issue mounting ISO downloaded from technet / internet

SharePoint 2013 - .master file not generated from masterpage html

Created a master page from seattle.html and uploaded it via a Sandbox solution. But the master page file .master was not generated automatically.

Saved the file manually and the .master file was generated.

Tried updating the file with powershell, still masterpage .master file not generated.

Noticed the following properties and the value was set to true for a successful conversion.

<mso:htmldesignconversionsucceeded msdt:dt="string">False</mso:htmldesignconversionsucceeded>

<mso:htmldesignstatusandpreview msdt:dt="string"></mso:htmldesignstatusandpreview>
used powershell to set the value to false and updated the file. The .master file was generated successfully.
Wrote a small powershell snippet as part of deployment to ensure that .master is generated before setting the masterpage.

word-wrap:break-word does not work

During troubleshooting a css where the text wrap was just not working even though the style had word-wrap:break-word included.

Later figured that there was another css property which was preventing it from working.

Added this to style and it started working.

white-space: normal;

Google Authenticator - Invalid pin

If you are facing invalid pin while trying to login to a two factor authenticated site with Google Authenticator, the question is did you travel outside your timezone? :)

In the Authenticator app there is a setting for time correction. You can sync time with the server and everything should be good again.