本文讲述SharePoint 2013如何在不同的环境之间(开发环境,测试环境,生产环境)移植由SharePoint designer 2013 设计的List Workflow。
在SharePoint 2010和2007 中,如果针对某个List 使用 SharePoint designer设计一个Workflow,通常我们有 三个环境(开发环境,测试环境,生产环境),但是我没办法把workflow 从开发环境移植到其他环境,需要在其他环境重复在 SharePoint designer设计该Workflow的步骤,也就是说至少要做三遍的重复劳动。
在SharePoint 2013里面就不需要这样了,只需要简单的几步就可以实现在各个环境中的移植。
但是因为SharePoint 2013环境中既可以 SharePoint 2010版本的工作流也可以运行SharePoint 2013版的新工作流, SharePoint 2010还是不能移植的,只有新建工作流时选择了平台为SharePoint 2013才移植:
但是SharePoint 2013安装好后默认是没有该选项的,需要安装配置Workflow Manager 1.0 ,如何安装配置Workflow Manager 1.0参考http://technet.microsoft.com/en-us/library/jj658588(v=office.15)。
以下步骤假设环境全部就绪:
1. 新建一个列表(命名为ListA)用于帮定工作流
2. 启动SharePoint designer 2013为ListA新建工作流,这里的例子是一个非常简单的工作流
3. 保存并发布该工作流
4.将该工作流另存为模板
5.另存成功的工作流模板在Site Asset中,将该模板导出到本地文件夹
6.将ListA另存为模板,并下载到本地文件夹
7.将ListA的模板上传到要迁移到的目标环境的对应网站的list template中
8. 在目标环境新建以ListA的模板为模板新建列表,同样要命名为ListA,和Site的相对路径要保持一致
9. 上传工作流模板Notification.wsp到目标环境的对应网站的solution 列表中
10. Active 该Solution
11. 在Site Feature找到Notification workflow相关的Feature 并active 该feature.
注意8,9步的顺序不能弄反,否则会出现如下错误:
Unexpected System.InvalidOperationException: System.ArgumentException: WSEventSourceGUID at Microsoft.SharePoint.WorkflowServices.WorkflowSubscriptionStorageEventReceiver.ItemAdded(SPItemEventProperties properties) at Microsoft.SharePoint.WorkflowServices.SPWorkflowPackageFeatureReceiver.FeatureActivated(SPFeatureReceiverProperties properties) at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce) at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean fo... 5ba2f29b-0de2-c096-b988-1adcf27a6c6c
01/08/2013 10:24:13.46* w3wp.exe (0x2894) 0x2DC0 SharePoint Foundation Runtime tkau Unexpected ...rce, Boolean fMarkOnly) at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, Int32 compatibilityLevel, String featureName, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope) at Microsoft.SharePoint.WebControls.FeatureActivator.ActivateFeature(Guid featid, Int32 compatibilityLevel, SPFeatureDefinitionScope featdefScope) at Microsoft.SharePoint.WebControls.FeatureActivatorItem.ToggleFeatureActivation() at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 5ba2f29b-0de2-c096-b988-1adcf27a6c6c