Documentation > CMS Template API Library > Asset > RouteAssets(List[Int32],Status,Boolean,Boolean)


Route assets in the given list to a workflow step that corresponds to the given status. The status must correspond to one of the steps on the assets' workflow. If more than one workflow step has the given state, then the lowest step will be chosen. Use Status.Load(string statusName) to load the status. If it returns false, check the context. Error property. Currently, you may only route file assets, routing folders in not supported.

public CrownPeak.CMSAPI.RouteResponse RouteAssets(List[Int32],Status,Boolean,Boolean)




AssetIdList The list of asset Ids to route. List<Int32>
status The status. CrownPeak.CMSAPI.Status
StateChangeCheck Flag for changing assets' workflow state before publishing System.Boolean
publishDependencies (Optional) Applies only when workflow results in a publish. If true, dependencies will be computed and published if necessary. Defaults to false. System.Boolean

Code Example


// Move the asset to the workflow step that has status set to "LIVE".
RouteResponse rr = Asset.Route(myAssetIds, oLiveStatus);
if (rr.HasError)
  Out.WriteLine("Route failed: " + rr.ErrorMessage);

Connect with Crownpeak