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

LoadByIdPath

Loads the asset specified by the id path which might look like /828/856/870, use Load(string) for "cpt_internal" style. If the asset does not exist in one of the valid states, an appropriate branch may be returned. Use IsLoaded to see if loading was successful. 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 LoadByIdPath(String)


Returns

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

Parameters

NameDescriptionType
path The path in Id format System.String

Code Example

C#

Sample:
Asset otherAsset = Asset.LoadByIdPath("/828/856/870");

if (!otherAsset.IsLoaded)
{
  Out.WriteLine("Could not find asset with id /828/856/870" );
}
             

Connect with Crownpeak