Adrian Hara

Working through the .NET maze

  Home  |   Contact  |   Syndication    |   Login
  46 Posts | 0 Stories | 108 Comments | 10 Trackbacks

News

Twitter












Archives

Post Categories

August 2008 Entries

Searching for a way to check if a workflow is running on a list item (useful, for example, in an item event handler), I found some code like this: public static bool IsWorkflowRunning(SPListItem listItem, Guid workflowId) { foreach (SPWorkflow workflow in listItem.Workflows) { if (workflow.ParentAssociation... == workflowId && workflow.InternalState == SPWorkflowState.Running) { return true; } } return false; } What this code does is iterate the workflows list for the item (point...

If you're developing workflows for SharePoint 2007, you are probably familiar with the Item property of the SPWorkflowActivationProperties class. Usually your workflow gets an instance of SPWorkflowActivationProperties when the OnWorkflowActivated activity executes, which is bound to a public field on the workflow class so you can hang on to it for the lifetime of the workflow. Perhaps one of the more useful properties of this class is Item, which returns an instance of SPListItem, representing the...