在下面的代码中,以下行
WorkflowResult result = wf.Execute(SitecoreItems.MediaWorkflowApproveCommand, item, "", false);
正在抛出Could not find command definition
错误。ID 和所有其他属性都有效,但命令定义无效。
关于可能导致它的任何想法?
using (new SecurityDisabler())
{
// Find all related items
ItemLink[] itemLinks = dataItem.Links.GetValidLinks();
foreach (ItemLink link in itemLinks)
{
Item item = link.GetTargetItem();
// publishing related media items - the ones that were referenced by the workflow item
// this can be extended - you can publish related aliases also
if (item != null && item.Paths.IsMediaItem)
{
//push field to the next state
IWorkflow wf = item.Database.WorkflowProvider.GetWorkflow(item);
WorkflowResult result = wf.Execute(SitecoreItems.MediaWorkflowApproveCommand, item, "", false);
}
}
}