I'm trying to create a site in my sharepoint hosted app using the javascript client object model in a SharePoint online site. I use a custom template when creating the site. This is my code:

var webCreationInfo = new SP.WebCreationInformation();

customerWeb = web.get_webs().add(webCreationInfo);

  Function.createDelegate(this, CreateSiteSucceeded),
  Function.createDelegate(this, ClientContextFailed));

The clientcontext is earlier instantiated in a separate function. The customercode, customername and template id are just variables with a value. When I execute the function, I get the following exception: "The request uses too many resources".

If I change the template to the standard team site like this:


Then I don't get exceptions.

I've read that this error could have something to do with exceeding the 2 mb request limit or exceeding the max number of objects paths which is 256 by default. This looks like a really basic operation to me. Why am I getting this error? Or how can I prevent it?

  • As Vardhaman pointed out there is an issue with your web template. Are familiar with Fiddler? Try Fiddling the web service request/response and see if there's any clues in there. Commented Jul 31, 2013 at 13:29
  • I'm going to try that. Hopefully I can find any clues in there
    – Marlou
    Commented Aug 1, 2013 at 7:10
  • It's getting even stranger. Sometimes it works and most of the times it don't. I compared the 2 requests in Fiddler, but they are the exact same size and I don't see any errors or other differences in the request. I'm only getting a different response :(
    – Marlou
    Commented Aug 1, 2013 at 8:25
  • could be a timeout issue. What are you getting in the response when it fails? Commented Aug 1, 2013 at 13:18
  • This is the response I'm getting [ { "SchemaVersion":"","LibraryVersion":"16.0.1810.1206","ErrorInfo":{ "ErrorMessage":"The request uses too many resources.","ErrorValue":null,"TraceCorrelationId":"96b0349c-ba64-80fa-37bb-294a51983fc7","ErrorCode":-2130246262,"ErrorTypeName":"Microsoft.SharePoint.SPException" },"TraceCorrelationId":"96b0349c-ba64-80fa-37bb-294a51983fc7" } ]
    – Marlou
    Commented Aug 1, 2013 at 13:27

2 Answers 2


It could be something to do with your Custom WebTemplate. What is the size of the template? Does it have lots of lists, pages, assets etc? Also check if you can create a site programmatically with the Server Object Model using your custom template.

See here: http://macslui.blogspot.in/2013/06/how-to-change-maxreceivedmessagesize.html

  • Document templates can also add lots of bloat to a web template. Commented Jul 31, 2013 at 13:32
  • The WSP is 792 kb and it has 12 lists in it. Would that be too much? I can't create the site with the server object model because I'm using SharePoint online. However I've tried to create a site based on my template in the interface and that works like it should.
    – Marlou
    Commented Aug 1, 2013 at 7:03
  • Derek, I have a number of document templates in it. Is it the number of templates that can cause problems or is it the size of the document templates?
    – Marlou
    Commented Aug 1, 2013 at 7:06
  • Yes I think the WSP is too big and that's why the call is taking too long and its failing. Commented Aug 1, 2013 at 7:11
  • I removed the document templates from my wsp and the wsp is now 286 kb but it still fails with the same message :(
    – Marlou
    Commented Aug 13, 2013 at 11:48

The template was created in a site collection that was upgraded from SP2010 to SP2013. I couldn't create a site with this template using the client object model in another site collection that was created in SP2013. I've recreated the template in the SP2013 site collection and that seems to work. Maybe there was something wrong with my site collection after the upgrade to SP2013. Still a strange error with a strange solution. :S

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.