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

Load

Loads an asset from the specified path - for example "/Site/Folder/Page". "cpt_internal" style links - "" and strings which contain only an asset id "870" are also supported. Use IsLoaded to see if loading was successful. Id paths which do not have "/cpt_internal" such as "/828/856/870" are not supported, use Asset.LoadByIdPath() instead. Results will depend on the current valid statuses (See context.FilterStatus). Note: Use LoadDirect to ignore statuses. 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. 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(String)



Parameters

NameDescriptionType
path

The path. An empty string will return an unloaded asset. Use "/" to load the root.

System.String

Code Example

C#

Sample:

             
             // Load a folder called "/Site/About Us"
             Asset otherAsset = Asset.Load("/Site/About us");
            
            
             

Connect with Crownpeak