Programatically creating a Site Workflow in SharePoint 2010?
I'm trying to create a new Site Workflow, bu开发者_StackOverflow中文版t 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?
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.
精彩评论