Microsoft SharePoint Client Server Exception: The Container node already has too nodes many nodes.

Modus Dev 1 Reputation point
2023-04-18T04:46:59.7066667+00:00

Subsite is not creating from few days. Please find the below code.

public bool InsertAskSubSite(string level3Title, string templateType, string description, string titleName)
        {
          
            WebCreationInformation webASk = new WebCreationInformation();
            webASk.WebTemplate = templateType;
            webASk.Url = level3Title;
            webASk.Title = titleName + " " + OMDALConstants.Ask;
            webASk.Description = description;
            webASk.UseSamePermissionsAsParentSite = true;
            webASk.Language = 1033;
            Web oweb = ClientContext.Site.RootWeb.Webs.Add(webASk);
            ClientContext.ExecuteQuery();
            return true;

        }
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,597 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,543 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,677 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,657 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-04-18T08:42:58.49+00:00

    Hi @Modus Dev

    Please check the value of templateType and OMDALConstants.Ask. Per my test, I can successfully create a subsite by following code

    WebCreationInformation oWebCreationInformation = new WebCreationInformation();
    // This is relative URL of the url provided in context
    oWebCreationInformation.Url = "NewSubSite";
    oWebCreationInformation.Title = "NewSubSite Site";
    oWebCreationInformation.Description = "NewSubSite description";
     
    // This will inherit permission from parent site
    oWebCreationInformation.UseSamePermissionsAsParentSite = true;
     
    // "STS#0" is the code for 'Team Site' template
    oWebCreationInformation.WebTemplate = "STS#0";
    oWebCreationInformation.Language = 1033;
     
    Web oWeb = clientContext.Site.RootWeb.Webs.Add(oWebCreationInformation);
    clientContext.ExecuteQuery();
    
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.