Documentation > CMS Template API Library > Asset > Load(AssetPath)

Load

Loads the asset with the specified path object Use IsLoaded to see if loading was successful. If the asset does not exist in one of the valid states, an appropriate branch may be returned. Results will depend on the current valid statuses (See context.FilterStatus). Depending on the use case there will be a list of legal statuses, the returned asset must not only match the provided path, but it must either have one of the valid statuses or have been published to a server with one of the valid statuses or have one of the statuses configured in its current workflow step. If there is more than one match, the asset with the highest id and therefore the one created most-recently is returned. Valid Statuses: Preview: All the states checked under System, MyAccount, Preferences in the section title "My Default Browse State(s)", plus "" (No-workflow) Publishing: The state associated with the current server for the workflow step and "" (no workflow). View Output: All state(s) associated with all servers configured for the current asset for the current workflow step and "" (no workflow). All Others Contexts: All states are legal

public CrownPeak.CMSAPI.Asset Load(AssetPath)


Returns

The asset. IsLoaded will be false if none was found.

Parameters

NameDescriptionType
path The path. CrownPeak.CMSAPI.AssetPath

Code Example

C#

Sample:
AssetPath path = AssetPath("/Site/About us");
Asset otherAsset = Asset.Load(path);    

Connect with Crownpeak