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

GetFolderType

Gets type of folder such as Project or Site Root. If the asset is not loaded or not a folder it will return "unspecified".

public CrownPeak.CMSAPI.FolderType GetFolderType()


Returns

A folder type.

Parameters

NameDescriptionType

Code Example

C#

Sample:
Asset folderAsset = Asset.Load("/PathToFolder/");	

if(folderAsset.IsLoaded)
{
  FolderType fType = folderAsset.GetFolderType();	
  if(fType == FolderType.Folder)
  {		
    Out.WriteLine("This is a folder.");
  }
  else if(fType == FolderType.SiteRoot)
  {
    Out.WriteLine("This is a site root.");
  }
}

Connect with Crownpeak