The Stack Overflow podcast is back! Listen to an interview with our new CEO.
2 added 85 characters in body
source | link

For adding to a specific content type. For lists should be the same. Good luck !

For adding to a specific content type. For lists should be the same. Good luck !

1
source | link

SPWorkflowTemplate baseTemplate =                                        currentSite.RootWeb.WorkflowTemplates.GetTemplateByName
                                                ("workflow", CultureInfo.InvariantCulture);
                                        SPWorkflowAssociation workflowAssociation =
                                            SPWorkflowAssociation.CreateListContentTypeAssociation(
                                                baseTemplate,
                                                "description",
                                                currentWeb.Lists["Tasks"],
                                                currentWeb.Lists["History"]);
                                        workflowAssociation.AllowManual = true;
                                        workflowAssociation.AutoStartChange = false;
                                        workflowAssociation.AutoStartCreate = false;
                                        siteContentType.WorkflowAssociations.Add(
                                            workflowAssociation);
                                        liste = currentWeb.Lists;
                                        foreach (SPList list in liste)
                                        {
                                            if (list.ContentTypes[0].Name == "ct")
                                            {
                                                list.WorkflowAssociations.
                                                    UpdateAssociationsToLatestVersion();
                                            }
                                        }