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


Loads the asset by id or an appropriate branch. For example, if you pass the id of an asset that is "RETIRED", and you are publishing to "LIVE", it will look for an asset on the same branch as the asset you were looking for that is in the "LIVE" state. Use IsLoaded to see if loading was successful. Note: Use LoadDirect to ignore statuses. 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(Int32)


The asset. IsLoaded will be false if no match was found.


assetId The asset id. System.Int32

Code Example


Asset otherAsset = Asset.Load(828);

if(otherAsset != null)
  Out.WriteLine("Found asset " + otherAsset.Label);

Connect with Crownpeak