Documentation > CMS Template API Library > Asset > CreateNewSiteRoot(String,Asset)

CreateNewSiteRoot

Create a Site root with the given label in the given location.

public CrownPeak.CMSAPI.Asset CreateNewSiteRoot(String,Asset)


Returns

The newly created site root.

Parameters

NameDescriptionType
label The label to use System.String
saveLocation The folder which is going to be the parent of the site root CrownPeak.CMSAPI.Asset

Code Example

C#

Sample:
string label = "CPTest";
Asset saveLocation = Asset.Load("/");

if(saveLocation.IsLoaded)
{
  Asset newSiteRoot = Asset.CreateNewSiteRoot(label, saveLocation);
  if(newSiteRoot.IsLoaded)
  {
    // Do Something
  }
}

Connect with Crownpeak