Monday, March 12, 2007

SharePoint 2007 workflow - AssociateonActivation

Some of you might have seen the AssociateOnActivation element in the workflow.xml (see example below) when building a SharePoint workflow in Visual Studio 2005 with the last build of the ECM Starter Kit and might be wondering what it is good for. Here's the explanation:

The value for AssociateOnActivation value will be false for most workflows but its value is set to true for the out-of-the-box document approval and collect feedback workflows. You probably noticed that these two workflows are available for all items in a SharePoint document library, although they are not in the list of workflow associations of the document library. This is because these workflows are associated to the document content type. So if you want to make your custom workflow automatically available on any item of the Document content type, just add <AssociateOnActivation> to true.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="Expense Report workflow"
Description="This workflow is used to approve expense reports"
Id="{9E778B0B-012F-43b9-A783-FF83C89AA736}"
CodeBesideClass="ExpenseWorkflow.Workflow1"
CodeBesideAssembly="ExpenseWorkflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=70c99ed3a3700cf4"
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"
AssociationUrl="_layouts/CstWrkflIP.aspx"
InstantiationUrl="_layouts/IniWrkflIP.aspx"
ModificationUrl="_layouts/ModWrkflIP.aspx"
StatusUrl="_layouts/WrkStat.aspx">
<Categories/>
<!-- Tags to specify InfoPath forms for the workflow; delete tags for forms that you do not have -->
<MetaData>
<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:ExpenseTaskForm:-myXSD-2007-02-24T15-08-38</Task0_FormURN>                                                     <AssociateOnActivation>false</AssociateOnActivation>
</MetaData>
</Workflow>
</Elements>

You should check out the upcoming SharePoint 2007 MVP book for more goodies such as this one.

 

1 comment:

Anonymous said...

Thanx man thas really usefull..