views:

251

answers:

1

I'm trying to create a new Site Workflow, but not through SP Designer or Visual Studio.

Instead, I would need to create it entirely through code (The logic is customizable and dynamic - Initiation Forms or Conditionals won't help much).

Do I have to build the .xoml and .rules files by hand? Or is there an API for designing workflows?

A: 

Not sure what you mean by not creating a workflow through Visual Studio. Do you mean you don't want to use the Visual Studio designer that is part of 2010? Or do you want to create a declarative workflow without code in 2010?

There is an API for workflows that has been improved with 2010 to allow for site workflows and more. There is more information at MSDN. Generally the use of the API is going to require some code behind type functionality.

You can use the API to create a workflow entirely in code if you want. However in my experience it is MUCH easier using the designer since it wired up lots of the events and helps you track the various IDs you may need.

If you want to hand code the XAML, you will need to adhere to the XOML schema that Microsoft has defined. In 2010 tools like Visio and SharePoint designer output files that can be read
by VS 2010. I believe the output format may be XOML, so that could get you started and you could modify on your own.

John Ptacek
I want to create code that generates workflows - zero human interaction. Do you have any pointers at which API would be appropriate?
Michael Stum
Here is an example for coding a Site workflow from MSDN http://msdn.microsoft.com/en-us/library/ee231574(VS.100).aspx Just so I understand... at some point something will initiate the workflow, it could be a user adding an item to a list, etc. You just don't want to have the user see any forms, etc?
John Ptacek
That's only an activity sadly, not the entire workflow. Basically there is an Event Receiver on a list, and when a new item is added, it is supposed to create a brand new workflow. The logic of that workflow is determined by a number of factors and it can be completely different each time, so it needs to be created entirely through code.
Michael Stum
Okay. I understand now.... That's an interesting problem :) Not sure I can think of anything right now
John Ptacek