1

I got the following line of code:

[Microsoft.SharePoint.Workflow.SPWorkflowManager]::RemoveWorkflowFromListItem($wf);  

I receive the error

Method invocation failed because [Microsoft.SharePoint.Workflow.SPWorkflowManager] doesn't contain a method named 'RemoveWorkflowFromListItem'

while other methods from workflowmanager (like "CancelWorkflow") work

  • 1
    You should use RemoveWorkflowFromListItem from site.WorkflowManager – Amal Hashim Nov 3 '14 at 14:07
  • CancelWorkflow is a static method of SPWorkflowManager, so the syntax below is correct: [Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($wf); You should call the instance method via an object reference as suggested by Amal Hashim – pholpar Nov 3 '14 at 14:16
  • CancelWorkflow is a static method of SPWorkflowManager, so the syntax below is correct: – pholpar Nov 3 '14 at 14:18
  • @OleAlbers Cool. I have posted it as answer. Hope it helps the community – Amal Hashim Nov 3 '14 at 14:21
  • So in the end is there a difference between CancelWorkflow and RemoveWorkflowFromListItem ? Do they do the same thing? – jeancallisti Nov 8 '18 at 18:24
1

You should use RemoveWorkflowFromListItem from site.WorkflowManager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.