SPList list = web.Lists.GetList(new Guid(listGuid), false);
SPListItem item = list.GetItemById(int.Parse(listItemId));
string currentStatus = item["Status"].ToString();
if (currentStatus == "Pending Approval")
{
SPWorkflowCollection workflows = item.Workflows;
// Do more stuff
}
Why does item.Workflows ALWAYS return nothing, even though I know there is a workflow running for this item.
I'm also sure I have the correct SPListItem object; the currentStatus condition confirms this.
I found these two questions that are related, but refer to SPListItem.Tasks rather than SPListItem.Workflows (perhaps they're related):
SPListItem.Tasks always empty
SPWorkflow.Tasks is empty when not in debug

0 commentaires:
Enregistrer un commentaire