Documentation > CMS Template API Library > Asset > Type

Type

Gets the type. It will be either a File or a Folder. It can be either an AssetType.File or an AssetType.Folder.

Type

CrownPeak.CMSAPI.AssetType

Value

The asset type.

Code Example

C#

Sample:
	Asset myAsset = Asset.Load("/PathTo/Asset");		
	if(myAsset.IsLoaded)
	{
		AssetType type = myAsset.Type;		
		Out.WriteLine("Asset Type: " + type.ToString() + "<br />");	

		if(type == AssetType.File)
		{
			Out.WriteLine("Is a file.");
		}
		else if(type == AssetType.Folder)
		{
			Out.WriteLine("Is a folder.");
		}
		
	}

Connect with Crownpeak