Documentation > CMS Template API Library > Asset > GetSiteRoot(Asset)

GetSiteRoot

For a given asset find the closest parent that is of FolderType.SiteRoot

public CrownPeak.CMSAPI.Asset GetSiteRoot(Asset)


Returns

The site root if found. If none is found returns an empty asset (IsLoaded will be false)

Parameters

NameDescriptionType
asset The requested site root asset. CrownPeak.CMSAPI.Asset

Code Example

C#

Sample:
Asset siteRootFolder = Asset.GetSiteRoot(asset);
Out.WriteLine(siteRootFolder.AssetPath.ToString());

Connect with Crownpeak