Hey folks, I’ve written previously about how to migrate code for claims users (such as Windows claims to SAML claims) in this post about the IMigrateUserCallback interface: http://blogs.technet.com/b/speschka/archive/2011/01/27/migrating-user-accounts-from-windows-claims-to-saml-claims.aspx. Just as with that post, our good friend Raju S. also had some other interesting information to add to this content today. One of our other “friends of the blog” Israel V. noticed that after a recent migration he did the identities for workflows were not updated. Turns out Raju had seen this before in a previous version of SharePoint (when migrating between different domains) and had done some code to fix up that issue. The net of what you need to do here is go through and look at your workflow associations, and update the accounts that are associated with them.
Each content type, list and web has a property called WorkflowAssociations where it stores this information. It’s just a collection so you can enumerate through each one, but as you can imagine, this may take some time to walk through an entire web application so plan accordingly. A specific workflow association is really just a chunk of Xml so it’s probably best to retrieve the AssociationData property and take a look at the Xml to get familiar with it. As you review it, you should notice nodes for person, account ID and display name – those are going to be the values that you want to change. After you change the Xml then you can just push it back into the AssociationData property and call the UpdateWorkflowAssociation method on the workflow association.
Thanks again to Israel for calling this problem out and to Raju for sharing his solution.