OfficeSPDev Uservoice: Creating Site Collections with CSOM providing LCID does not work

When creating Sharepoint Site Collections through CSOM and providing the LCID, the Site Collection is not being created. Instead a wrong error message is thrown saying:

SiteCreationProperties.Template\r\nParameter name: Specified value is not supported for the SiteCreationProperties.Template parameter.

I’ve logged this towards Microsoft in an OfficeSPDev UserVoice entry. Much appreciated if you vote for it 😉

using (ClientContext ctx = new ClientContext("<site Allowing Self Service Site Creation>"))
{
  //ctx.Credentials = new NetworkCredential("");
  var tenant = new Tenant(ctx);
  var properties = new SiteCreationProperties()
  {
    Url = "<enter some SiteCollection Url To be Created>",
    Owner = @"<some User Account>",
    Title = "Test CSOM",
    Template = "STS#1", //Blank Site
    Lcid = 2067
  };
  SpoOperation op = tenant.CreateSite(properties);
  ctx.Load(op, i => i.IsComplete);
  ctx.ExecuteQuery();
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.