I'm trying to fix a basic workflow that's not currently working, for some reason it's cancelling the workflow - I think it's something to do with check in / check out. I'm not too worried about this issue, I can work it out. However, what's frustrating me is during testing when a workflow has been cancelled on a document, I can't find any easy way to restart the workflow on a document.

Currently I select the document workflow> Name of the workflow >End this workflow> OK> then navigate back to the library > select the document workflow again> Start a new workflow (name of the workflow) manually> Start.

It's such a round about way, I expect if a workflow is 'cancelled' then the workflow should have stopped. In the same way it does when it's 'Completed'.

Is there a quicker way to do this? I'm thinking ahead as to when my clients take over the system, they may encounter the same (long winded) issue.

1 Answer 1


You can start the workflow using code. The code has to be triggered somehow. You could use an Event Receiver for when a document is either added or updated.

If you need to be able restart a workflow by just clicking something. You could create an application page that does that. Populate a column with a hyperlink for each item.

Reference: http://blogs.msdn.com/b/nishand/archive/2008/08/27/how-to-add-remove-and-start-workflow-programmatically.aspx

   1: SPSite site = new SPSite("http://localhost");

   2: SPWeb web = site.OpenWeb();

   3: SPList list = web.Lists["Shared Documents"];

   4: SPWorkflowAssociation association = AddWorkflow(); // Above function to get the SPWorlflowAssociation object

   5: SPWorkflowManager manager = site.WorkflowManager; 

   6: for (int idx = 0; idx < 10 ; idx++) // I'm assuming there would be atleast 10 items within the library

   7: {

   8: SPListItem item = list.Items[idx];

   9: manager.StartWorkflow(item,association, "you can pass any data here",true);

  10: }
  • This is really useful, we're going to be migrating thousands of documents, it'll be impossible for me to manually start all workflows that have been cancelled. We'll give this a go. Thank you.
    – Haz
    Commented Feb 5, 2015 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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