Documentation > CMS Template API Library > Asset > SetAsSiteRoot(Boolean)
SetAsSiteRoot
Makes the asset into a site root. Must be a folder and user must have permission to create a site root in the parent folder of the asset.
public System.Boolean SetAsSiteRoot(Boolean)
Returns
true if successful, false if not
Parameters
Name | Description | Type |
---|---|---|
doSetAsSiteRoot | (Optional)If false resets a site root back to a regular folder. Defaults to true | System.Boolean |
Code Example
C#
Sample:
Asset anAsset = Asset.Load("/MySiteFolder"); if (!anAsset.SetAsSiteRoot()) Out.DebugWriteLine("Failed to make asset id {0} into a site root error {1}", anAsset.Id, context.Error);