Is there a way to publish a reusable workflow programmatically instead of having to do it manually from SharePoint Designer?
I would like to write a script that identifies any workflows in a SharePoint site that have pending changes and then publish them automatically.
Please see this article: http://msdn.microsoft.com/en-us/library/ee231606.aspx
In addition to creating site-specific reusable workflows, SharePoint Designer enables you to create globally reusable workflows, which are workflows that can be used by any SharePoint site. The Import Reusable Workflow project in Visual Studio currently does not currently import globally reusable workflows. However, you can either use SharePoint Designer to convert a globally reusable workflow into a reusable workflow, or import the workflow as an unconverted declarative workflow. For more information, see Importing Items from an Existing SharePoint Site.
Regards, Savoeurn Va Microsoft Online Community Support
2012年8月22日 17:07Thanks, Entan! I appreciate your help.
Thanks for your reply, Savoeurn Va.
I'm sure I've misunderstood your answer, but I couldn't find information in the link related to publishing a workflow programmatically.
The following are further details of my situation which shows what I want I want to accomplish:
a. All the workflows in our SharePoint 2010 site were created using SharePoint Designer. We don't want to import them to Visual Studio any time soon, as it's too late in the stage of the project right now.
b. From a script (possibly using PowerShell), I want to find workflows with pending changes and automatically publish them. The publishing aspect replaces the following manual steps to publish a workflow:
1. Open SharePoint Designer
2. Click "Workflows" on the "Site Objects" pane.
3. On the "Workflows" tab, click the name of the reusable workflow to publish.
4. On the Ribbon, click "Publish"
I'm sure there must be a way publish workflows programmatically, since the "Publish" button on SharePoint Designer must call something to publish workflows, and so does the publishing functionality of other SharePoint tools like "K2".
Thanks again for your help.
- 編集済み Joseph Sunico 2012年8月22日 17:36
I guess this question is something that no one seems to have an answer for and that I'm the only one interested in. I've searched the web and it seems like I'm the only one who has asked this question. Seems surprising to me that no one has tried publishing workflows programmatically, before though.
I've decided to just create a PowerShell script that identifies all workflows that have pending changes and just publish them manually. This is much faster than having to manuallly publish all 40+ workflows from SharePoint Designer.
- 回答としてマーク Entan MingMicrosoft Contingent Staff, Moderator 2012年8月29日 11:35
I am also interested in that ... but like you, I couldn't find anything.
I think that we will have to encapsulated SharePoint Designer DLL in order to call the "Publish" and "PublishGlobally" methods (if they exist, and if we can use them, I don't know yet) ... I did not find anything in SharePoint API that lets us do that ... It's a pity unfortunatelly.
If i come up with something i'll update this post!
2013年2月25日 20:06Anyone found a way to publish a workflow programmatically??
JP Berube | MCTS SharePoint 2010 Configuration and Application Development