Home Sign In

Steven Van de Craen's Blog

Bloggings about SharePoint, .NET and more.

RSS Feed
  • Contact Me

Archives

  • July 2007 (19)
  • August 2007 (6)
  • September 2007 (3)
  • November 2007 (12)
  • October 2007 (4)
  • December 2007 (8)
  • January 2008 (6)
  • February 2008 (3)

Categories

  • SharePoint 2003
  • SharePoint 2007
  • General
  • Office 2003
  • Office 2007
  • Excel Services
  • Dynamics NAV
  • SOAP
  • Search
  • Search Server 2008
  • .NET
  • CKS
  • IIS

Recent Posts

  • SharePoint Errors: 6482, 7888, 6398 and 7076
  • Feature Activation Dependency + Hidden = Automagic
  • FieldRefs node in new Content Type XML
  • TechDays 2008
  • SPTreeView: Selected node CSS bug

Other Blogs

  • //BLOG: naked programmer
  • JOPX
  • Jan Tielens' Bloggings [MVP]
  • Serge van den Oever [Macaw]
  • Carlos Segura Sanz
  • -->Patrick Tisseghem's Blog [MVP SharePoint] -->
  • Remco Ploeg's Blog
  • SharePoint Blogs
  • Romeo Pruno
  • [email protected]
  • Andrew Connell [MVP MOSS]
  • Mark Harrison
  • Pedro Serrano
  • Clemens Vasters and the Indigettes
  • Kevin Boske
  • SharePoint Team Blog
  • Brian Jones: Office XML Formats
  • Mart Muller's Sharepoint Weblog
  • Joel Oleson's SharePoint Land
  • Kris' blog
  • STSADM Custom Extensions
  • Microsoft Enterprise Search Blog
  • Michaël's coding thoughts
  • Chris O'Brien's blog
  • John Holliday's SharePoint Reflections

Cancelling a SharePoint Workflow

Terminating the workflow will set its status to Canceled and will delete all tasks created by the workflow.

Via browser interface

Via code

// Cancel
SPWorkflowManager.CancelWorkflow(workflowProperties.Workflow);

Applies To

  • Windows SharePoint Services 3.0 (+ Service Pack 1)
  • Microsoft Office SharePoint Server 2007 (+ Service Pack 1)
 
Categories: .NET, SharePoint 2007

Trackback Url

 

Comments

Thursday, 21 Feb 2008 02:08 by Dwayne
When I attempt to execute this command on an active workflow, I receive the following error: System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context) at Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(HttpContext context) at Microsoft.SharePoint.SPContext.get_Current() at Microsoft.SharePoint.SPListItem.GetValue(SPField fld, Int32 columnNumber, Boolean bRaw) at Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException) at Microsoft.SharePoint.SPListItem.GetValue(String strName) at Microsoft.SharePoint.SPListItem.InitItemID() at Microsoft.SharePoint.SPListItem.get_ID() at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents) at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents) at Microsoft.SharePoint.SPListItem.Update() at Microsoft.SharePoint.Workflow.SPWorkflow.CreateHistoryEvent(Guid instanceId, Guid templateId, Guid baseTemplateId, SPList historyList, Int32 eventId, Object groupId, Guid listId, Int32 itemId, String mwsInstanceId, Int32 userId, TimeSpan duration, String outcome, String description, String otherData) at Microsoft.SharePoint.Workflow.SPWorkflow.CreateHistoryEvent(Int32 eventId, Object groupId, SPMember user, TimeSpan duration, String outcome, String description, String otherData) at Microsoft.SharePoint.Workflow.SPWorkflowManager.<>c__DisplayClassc.b__a() at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state) at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Microsoft.SharePoint.Workflow.SPWorkflowManager.CancelWorkflow(SPWorkflow workflow) What would be the likely cause of this?

Friday, 22 Feb 2008 05:16 by Sam
I have the same problem.

Leave a comment

Name

Url

Email

Comments

CAPTCHA Image Validation

© 2007 Steven Van de Craen — Powered by Community Kit for SharePoint: Enhanced Blog Edition.