Associating a workflow to a content type

We added metadata columns to our content type, we added a document template that provides the common format for uploading project proposals to the library, and in this recipe we will add "Approval workflow" to our content type.

Approval Workflow is out-of-the-box workflow available in the SharePoint server.

Getting ready

You should have completed the previous recipes successfully.

How to do it...

  1. If you have closed Visual Studio IDE, launch it as an administrator.
  2. Open the previously created ProjectProposal solution.
  3. Open Feature1.EventReceiver.cs file and add code to associate the workflow before the content type update method in the feature's activating method. Your code should look like the following:
    //Associate ...

Get Microsoft SharePoint 2010 Developer Compendium now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.