Worklow association to Content Type by CODE

I am facing with a problem when I tried to associate a workflow to a Content Type through code.

I want to create a Content Type that has a workflow associated to it. Later on when users can add this Content Type to their libraries, the document inside libraries can initate this workflow.

I have done all the SPWorkflowAssociation bit and have done the ContentType.AddWorkflowAssociation(association) stuff. Everything seems to be working ok.

I then added the Content Type to a newly created Document Library. And then I newed a document with that Content Type, the document item has a Workflows button (from the pull down menu)--this leads me to think that the Workflow has been successfully associated to the Content Type.

But when I clicked on the workflows button, I cannot find my workflow in the workflow.aspx page. I wonder what might have gone wrong...

I have saw some blogs saying that workflow association to Content Type is not working in spite what you and the SDK have said.

I just wonder what is your opinion on this. Can some share some wisdom here

Thank you very much.

Keno




Answer this question

Worklow association to Content Type by CODE

  • Avotas

    I took my question back. There was a programming bug in the program. It is indeed possible to associate a workflow to a content type. No problem.

    Thanks.

    Keno



  • Guillaume DAVID

    could you please share the code to associate the content type with workflow,thanks


  • Worklow association to Content Type by CODE