none
CSOM site provisioning error: The request uses too many resources. RRS feed

  • Question

  • I continue to get an error (sometimes) when provisioning a web using CSOM.  According to the following MSDN article, https://msdn.microsoft.com/en-us/library/office/jj163082.aspx, this error is returned when the CSOM request exceeds 2MB.  I watched the call in Fiddler and the request is not greater that 2MB.  What could the problem be?  Below is the code and request/response from fiddler:

    Code:

    using (ClientContext cc = new ClientContext(url))
    {
    
    	cc.Credentials = new SharePointOnlineCredentials(username, password);
    
    	WebCreationInformation information = new WebCreationInformation();
    	information.WebTemplate = "CMSPUBLISHING#0";
    	information.Description = "";
    	information.Title = "My Pub Site";
    	information.Url = "mypubsite";
    	// Currently all English, could be extended to be configurable based on language pack usage
    	information.Language = 1033;
    	information.UseSamePermissionsAsParentSite = false;
    
    	cc.Web.Webs.Add(information);
    	cc.ExecuteQueryRetry();
    
    }

    Fiddler Request: 

    <Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath
     Id="1158" ObjectPathId="1157" /><ObjectIdentityQuery Id="1159" ObjectPathId="1157" /></Actions><ObjectPaths><Method Id="1157" ParentId="923" Name="Add"><Parameters><Parameter
     TypeId="{8f9e9fbe-189e-492f-884f-98f9ef9cc4d6}"><Property Name="Description" Type="String"></Property><Property Name="Language" Type="Int32">1033</Property><Property Name="Title"
     Type="String">Manuals</Property><Property Name="Url" Type="String">manuals</Property><Property Name="UseSamePermissionsAsParentSite" Type="Boolean">false</Property><Property
     Name="WebTemplate" Type="String">CMSPUBLISHING#0</Property></Parameter></Parameters></Method><Property Id="923" ParentId="384" Name="Webs" /><Identity Id="384"
     Name="7e19049d-e009-2000-008d-b659834a548f|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:a43f2ef7-f1aa-423a-ad26-59b66edef6bb:web:a30643dc-7034-47ae-b87e-119ef8a2975d" /></ObjectPaths></Request>
    


    Fiddler Response:

    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Type: application/json; charset=utf-8
    Vary: Accept-Encoding
    Server: Microsoft-IIS/8.5
    X-SharePointHealthScore: 0
    X-SP-SERVERSTATE: ReadOnly=0
    SPClientServiceRequestDuration: 7513
    X-AspNet-Version: 4.0.30319
    SPRequestGuid: 7e19049d-601e-2000-008d-b31e125c7e26
    request-id: 7e19049d-601e-2000-008d-b31e125c7e26
    X-RequestDigest: 0x1B109C2C5737406AB9E9A2983D743443F86CEF7D92CD6041BB1510FCDD2A4866A55C5BF0D32E4E55C4448C12C9727F191740AAF929E6353320C1CAE0FBBC1D16,07 May 2015 17:27:33 -0000
    X-FRAME-OPTIONS: SAMEORIGIN
    X-Powered-By: ASP.NET
    MicrosoftSharePointTeamServices: 16.0.0.4021
    X-Content-Type-Options: nosniff
    X-MS-InvokeApp: 1; RequireReadOnly
    P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
    Date: Thu, 07 May 2015 17:27:40 GMT
    Content-Length: 574
    
    [
    {
    "SchemaVersion":"15.0.0.0","LibraryVersion":"16.0.4021.1200","ErrorInfo":{
    "ErrorMessage":"Provisioning did not succeed. Details: Failed to initialize some site properties for Web at Url: 'https:\u002f\u002fslalomdev123.sharepoint.com\u002fsites\u002fPaulDev\u002fcompany\u002fACS\u002fmanuals' OriginalException: The
     request uses too many resources.","ErrorValue":null,"TraceCorrelationId":"7e19049d-601e-2000-008d-b31e125c7e26","ErrorCode":-2146232832,"ErrorTypeName":"Microsoft.SharePoint.SPException"
    },"TraceCorrelationId":"7e19049d-601e-2000-008d-b31e125c7e26"
    }
    ]


    • Edited by pbrenny Thursday, May 7, 2015 6:12 PM
    Thursday, May 7, 2015 5:58 PM

Answers

  • Hi,

    Please refer to the following code snippet to create a subsite.

    public void CreateSubSite()
    {
        string targetSiteURL = @"https://dennis.sharepoint.com/sites/Dennis";
    
        var login = "v-denguo@dennis.onmicrosoft.com";
        var password = "******";
    
        var securePassword = new SecureString();
    
        foreach (char c in password)
        {
            securePassword.AppendChar(c);
        }
        SharePointOnlineCredentials onlineCredentials = new SharePointOnlineCredentials(login, securePassword);
    
        ClientContext context = new ClientContext(targetSiteURL);
        context.Credentials = onlineCredentials;
        context.RequestTimeout = 10 * 60 * 1000;
        WebCreationInformation information = new WebCreationInformation();
        information.WebTemplate = "STS#0";
        information.Description = "";
        information.Title = "My Pub Site";
        information.Url = "mypubsite";
        // Currently all English, could be extended to be configurable based on language pack usage
        information.Language = 1033;
        information.UseSamePermissionsAsParentSite = false;
    
        context.Web.Webs.Add(information);
        context.ExecuteQuery();
    }

    Best Regards,

    Dennis


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Friday, May 8, 2015 8:31 AM
    Moderator
  • I ran into the same issue yesterday.  Only seems to throw the server exception when attempting to create a publishing site.  Was able to resolve by putting a retry block around this call. 



    Friday, May 15, 2015 12:18 PM

All replies

  • Hi,

    Please refer to the following code snippet to create a subsite.

    public void CreateSubSite()
    {
        string targetSiteURL = @"https://dennis.sharepoint.com/sites/Dennis";
    
        var login = "v-denguo@dennis.onmicrosoft.com";
        var password = "******";
    
        var securePassword = new SecureString();
    
        foreach (char c in password)
        {
            securePassword.AppendChar(c);
        }
        SharePointOnlineCredentials onlineCredentials = new SharePointOnlineCredentials(login, securePassword);
    
        ClientContext context = new ClientContext(targetSiteURL);
        context.Credentials = onlineCredentials;
        context.RequestTimeout = 10 * 60 * 1000;
        WebCreationInformation information = new WebCreationInformation();
        information.WebTemplate = "STS#0";
        information.Description = "";
        information.Title = "My Pub Site";
        information.Url = "mypubsite";
        // Currently all English, could be extended to be configurable based on language pack usage
        information.Language = 1033;
        information.UseSamePermissionsAsParentSite = false;
    
        context.Web.Webs.Add(information);
        context.ExecuteQuery();
    }

    Best Regards,

    Dennis


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Friday, May 8, 2015 8:31 AM
    Moderator
  • I ran into the same issue yesterday.  Only seems to throw the server exception when attempting to create a publishing site.  Was able to resolve by putting a retry block around this call. 



    Friday, May 15, 2015 12:18 PM
  • How changing publishing template (information.WebTemplate = "CMSPUBLISHING#0"; )  to team template (information.WebTemplate = "STS#0";) is considered a solution?

    I have a custom template created without publishing and it was working fine before two days and suddenly it started giving following error:

    “The request uses too many resources”

    It is disappointing that Microsoft’s flagship product which has been released for few years now, still does not work for basic operation like publishing site provisioning. I am following the sample code made available at the pnp git hub. The sample works for base team site, but for any custom web template returns “too many resources”!

    I have already cranked site collection resources but that does not seem to affect this error. I have also tried with a fresh site collection but that does not help either. Any more ideas to successfully create a sub site based on a webtemplate?

    Saturday, June 6, 2015 7:35 AM