Documentation > CMS Template API Library > Asset > SetSiteRootProperties(Int32,SiteRootProperties)

SetSiteRootProperties

Can be used to set the site root properties. User must have both view permission on the actual site root and permission to create and edit site roots set. You cannot edit branch configuration at this time.

public CrownPeak.CMSAPI.SiteRootProperties SetSiteRootProperties(Int32,SiteRootProperties)


Returns

The resulting properties. Use context.Error to check for a failure

Parameters

NameDescriptionType
assetId The id of the site root or an asset that is located within System.Int32
props The properties to change CrownPeak.CMSAPI.SiteRootProperties

Code Example

C#

Sample:
SiteRootProperties props = Asset.GetSiteRootProperties(asset.Id);
if (!string.IsNullOrWhiteSpace(context.Error))
{
  // Handle error.
  Out.WriteLine("GetSiteRootProperties Error :" + context.Error);
}
else
{
  props.DefaultExtension = "html";
  Asset.SetSiteRootProperties(asset.Id, props);
  if (!string.IsNullOrWhiteSpace(context.Error))
  {
    // Handle error.
    Out.WriteLine("SetSiteRootProperties Error :" + context.Error);
  }
}

Connect with Crownpeak