I've written some code to add a couple of workflows to an existing document library. Basically, it's not more then these lines of code:
// Create an association for the default approval workflow
workflowAssociation =
SPWorkflowAssociation.CreateListAssociation(approvalWorkflowTemplate, "Approval", taskList, historyList);
list.WorkflowAssociations.Add(workflowAssociation);
When I execute this and then check the settings of the list, I can see the workflow, added under All/Everything (not sure what the correct translation is). But when I select a document, in this case a PDF file (but that shouldn't matter I think), it says there are no workflows available for starting. I've also checked the workflow settings to see if it's allowed to start the workflow manually, which is the case. And of course I'm logged in as a user with enought rights to actually start the workflow. Any ideas what I'm missing here?
Update: When I manually add the workflow to the list (NOT to the ContentType specifically), it seems to work fine. So it looks like the changes are somehow pushed down to the list content type instances, where they're not in my code example. I can think of two options: either push down the changes myself by adding the workflow association to all list content types as well, or find the way SharePoint does that same thing and call it. I would prefer that last option, but untill now I didn't find a method which seems to do this.
Update 2: I now copied the SPWorkflowAssociation object down to the list content types, and still nothing :S If I check the list configuration, they're listed under the contenttypes and the settings are set to allow manual starting (even explicitely did this in code), but once more; the flows aren't visible on the workflow page for an item.