Sunday, May 4, 2014

Resolve <nativehr>0x80070005</nativehr> at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex) at Microsoft.SharePoint.Library.SPRequest.CreateSite in SharePoint 2013

Above exception was occurring frequently when SharePoint sites are created from an external system.

In our SharePoint environment we have a WCF service to create sites based on a customized site template. In the site creation method we have following code block wrapped with RunWithElevatedPrivileges to create site collections in a particular web application.

  1. var webApp = SPWebApplication.Lookup(new Uri(appUrl));
  2. var site = webApp.Sites.Add(siteUrl, siteTitle, "", 1033, "ContosoSites#01", login, userName, "");

We found that the application pool account of the site creation WCF service does not have sufficient permissions. Following are the steps we followed to resolve the error

1. Change the application pool account of the WCF service

Use application pool credentials used for central administration (SharePoint\SP_Connect) as the application pool identity of the WCF service

image

2. Add permissions to the web application

Navigate to user policy for the web application and provide full control to the application pool account

image

That’s all we need to do.

No comments: