Documentation > CMS Template API Library > Asset > Rename(String)

Rename

Renames the asset to the specified label.

public System.Boolean Rename(String)


Returns

True if successful, false otherwise.

Parameters

NameDescriptionType
newLabel The new label. System.String

Code Example

C#

Sample:
Asset myAsset = Asset.Load("/Site/Press Releases/2010_11_07_Amazing_Day");
myAsset.Rename(myAsset.Label.Replace('_','-'));

Connect with Crownpeak