El Blanco's Office 2007 Blog

Wednesday, July 12, 2006

Migrating a WorkFlow from beta1 TR to beta2

Just another quickie for today. I recently ported an existing SharePoint workflow written using VS.NET in beta1 TR timescales to the new beta2 products and thought I'd post a few of the nasties that I found along the way regarding changes between the two - some people said beta1TR workflows wouldn't work in beta2, but with a little tweaking you CAN save yourself the hassle of having to re-write them !

  1. To programatically associate a workflow with a list you use the SPWorkflowAssociation class. This used to have a constructor that you used to associate a workflow with a list, but now you need to call the static method SPWorkflowAssociation.CreateListAssociation instead.
  2. The SPLongOperation class moved from the Microsoft.SharePoint.ApplicationPages namespace to the Microsoft.SharePoint namespace (we used this a lot to oversee long running operations). I couldn't find any reference in the documentation to this class and had to use Reflector to find it.
  3. Any internal and private members you had written in the workflow.cs file that are referenced in the activity properties in the workflow designer all have to be made public as they can't be referenced otherwise ! These were giving errors in the workflow designer (i.e. the red exclamation points) but making them public, and double clicking on the blue icon next to the properties in the designer to rebind them solved this.
  4. When defining the workflow.xml file you need to have the line:

    TaskListContentTypeId=
    "0x01080100C9C9515DE4E24001905074F980F93160"

    in the <workflow> tag. If not, when you click on a task that the workflow has created, you get the out-of-the-box task properties edit form instead of any custom InfoPath forms you've specified. This GUID refers to a content type defined in an out-of-the-box feature which the out-of-the-box workflows appear to reference in their workflow.xml files too. I'm not sure why it's needed, but it won't work without it - this one took me an age to find :)

That's about it - if anyone has any more problems they've encountered upgrading beta1 TR workflows to beta2 I'd be interested to hear from you . . .

0 Comments:

Post a Comment

<< Home