Today i was trying to figure out how to set the option 'Start this workflow to approve publishing a major version of an item' on my SharePoint list workflow. After some research I found out that the way to go is this:

  1. Cast the SPList object to an SPDocumentLibrary
  2. Attach the workflow to the document library object
  3. Set the DefaultContentApprovalWorkflowId
  4. Update the list

The code will be something like this:

// list is an SPList object, workflowAssociation is an SPWorkflowAssociation object
SPDocumentLibrary docLib = (SPDocumentLibrary)list; // cast
docLib.WorkflowAssociations.Add(workflowAssociation); // attach
docLib.DefaultContentApprovalWorkflowId = workflowAssociation.Id; // set property
list.Update(); // save the list