Search code examples
javasharepointsharepoint-onlinesharepoint-rest-api

Sub-Site creation delays via REST API method


I need to create SharePoint Sub-Sites under a Site Collection from a Java application.

The first set of Sub-Sites were created in a few seconds per Sub-Site(parent Site). As more and more subpages are being created, the process gets slower and slower.

Now a sub-site is created in 150 seconds and I cannot figure out why.

String json = 
{
  "parameters": {
    "__metadata":{
      "type":"SP.WebInfoCreationInformation"
    }, 
    "Title":"TITLE",
    "Url":"URL",
    "Description":"DESCRIPTION", 
    "WebTemplate":"STS",
    "Language":"1038",
    "UseUniquePermissions":"false"
    }
}
HttpPost post = new HttpPost("http://x.sharepoint.com/sites/x/_api/web/webinfos/add");
post.setHeader("Authorization", "Bearer " + token);
post.setHeader("Accept", "application/json;odata=verbose");
post.setHeader("Content-Type", "application/json;odata=verbose");
post.setEntity(new StringEntity(json, "UTF-8"));
httpclient.execute(post);

The last row is processed for a duration of 150 seconds.

Thanks in advance if anyone can help me with what is causing the slowdown.


Solution

  • Well, according to the general guidelines that Microsoft has released in terms of SharePoint Architecture, it is stated pretty clearly in the Service Limits that the Sub-Sites of a Site Collection should not exceed 2000 in amount, and that metric is per Site Collection.

    Now given the fact that you have created 13.000 Sub-Sites and wish to have, around 50.000 under one Site Collection at the end, as you mentioned in the comments, your problems of long-waiting REST calls are explained by the reasoning that you might have stretched the Content Database to a point where writing any new lines to it might take a really long time.

    Since the problem is located at the SharePoint level and, in addition, since you do not have access to view the logs, the only next step that you can take is open a ticket from your tenant and have the support take a look at your issues.

    Although, there is a good possibility that their reply will be the same, that you have exceed the suggested amount of subsites and should thin it a bit by either splitting the Sub-Sites among different Site Collections or using a different architecture.