将SharePoint 2010的workflow custom activity升级到SharePoint 2013遇到的问题
来源:互联网 发布:mac os x使用手册 编辑:程序博客网 时间:2024/06/05 05:56
前几天需要升级一个自定义的workflow activity,从支持SharePoint 2010的版本,升级到支持SharePoint 2013。 Branch代码出来之后,在VS工程中直接升级,之后编译,部署一切都很顺利,但是在测试的时候出现问题了。
问题是这样的:打开SharePoint Designer 2013,新建一个workflow,在workflow里使用自定义的activity,定义好了之后,保存,然后发布的时候,Designer报了一个错误:
“Errors were found when compiling the workflow. The workflow files were saved but cannot be run.” 具体的信息是“The type or namespace name xxx could not be found (are you missing a using directive or an assembly reference?)”。
我查了一下才知道(请参见点击打开链接),web.config文件中的<authorizedTypes>结构变了,在SharePoint 2013中加了一个子节点<targetFx>,因此需要将自定义的activity的authorizedType加到这个子节点中才行。
以下是2010中的配置文件和2013中的配置文件的对比:
SharePoint 2010:
<System.Workflow.ComponentModel.WorkflowCompiler> <authorizedTypes> <authorizedType Assembly="Microsoft.Office.Workflow.Actions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.Office.Workflow.Actions"TypeName="*"Authorized="True" /> <authorizedType Assembly="MyActions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1234567"Namespace="MyActions"TypeName="*"Authorized="True" /> </authorizedTypes> <authorizedRuleTypes> <authorizedType Assembly="Microsoft.SharePoint.WorkflowActions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.SharePoint.WorkflowActions"TypeName="WorkflowCodeTypeReferenceExpression"Authorized="True" /> </authorizedRuleTypes></System.Workflow.ComponentModel.WorkflowCompiler>SharePoint 2013:
<System.Workflow.ComponentModel.WorkflowCompiler> <authorizedTypes> <targetFx version="v4.0"> <authorizedType Assembly="Microsoft.Office.Workflow.Actions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.Office.Workflow.Actions"TypeName="*"Authorized="True" /> <authorizedType Assembly="MyActions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1234567"Namespace="MyActions"TypeName="*"Authorized="True" /> </targetFx> </authorizedTypes> <authorizedRuleTypes> <targetFx version="v4.0"> <authorizedType Assembly="Microsoft.SharePoint.WorkflowActions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.SharePoint.WorkflowActions"TypeName="WorkflowCodeTypeReferenceExpression"Authorized="True" /> </targetFx> </authorizedRuleTypes></System.Workflow.ComponentModel.WorkflowCompiler>
以下是正确的修改配置文件的代码:
var service = SPWebService.ContentService;var addModification = new SPWebConfigModification();addModification.Path = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes/targetFx";addModification.Name= "authorizedType[@Assembly='MyActions'][@Namespace='MyActions'][@TypeName='*'][@Authorized='True']";addModification.Owner= "MyActions";addModification.Sequence= 0;addModification.Type= SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;addModification.Value= @"<authorizedType Assembly=""MyActions""Namespace=""MyActions"" TypeName=""*""Authorized=""True"" />"; service.WebConfigModifications.Add(addModification);service.Update();service.ApplyWebConfigModifications();
- 将SharePoint 2010的workflow custom activity升级到SharePoint 2013遇到的问题
- 为SharePoint 2010 Workflow 开发 Custom(自定义的) Workflow Activity
- 为SharePoint 2010 Workflow 开发 Custom(自定义的) Workflow Activity
- 将SharePoint 2010的站点模板(site template)升级到SharePoint 2013
- SharePoint 2010 升级到SharePoint 2013的流程
- Sharepoint 2007上应用workflow遇到的一些问题
- 开发SharePoint 2013 Workflow遇到的实例不更新的问题
- Sharepoint Workflow 获取中文栏的问题
- SharePoint 2010 升级到 SharePoint 2013 之 使用 Test-SPContentDatabase
- sharepoint 2010 custom webpart与custom webpart的联动方法
- SharePoint 升级4 将内容数据库升级到 SharePoint 2013(Upgrade content databases to SharePoint 2013)
- Context-Aware SharePoint Designer Custom Workflow
- SharePoint 2013 Workflow 分布式配置问题记录
- Custom Outcome Options of Task Form in SharePoint Designer on SharePoint 2013 Workflow
- SharePoint designer 2013 中新的workflow action(操作)
- Sharepoint 2013 修改html母版页遇到的问题
- sharepoint 2010 安装补丁升级sharepoint 2010版本遇到“未在系统中找到期望的产品版本”
- 记录SharePoint 2010 Custom TimerJob问题
- socket ip地址的写法等(vc源码)
- lua求表中最大值序号及最大值的的函数(lua实现)
- Java布局管理器(五)之BoxLayout布局管理
- lua 中调用函数特殊的写法(lua语言)
- Cocos2d-x中的Visual studio 2012环境搭建(懒人专用)
- 将SharePoint 2010的workflow custom activity升级到SharePoint 2013遇到的问题
- 使用NPOI操作Excel导入导出数据
- 6.4.11:子查询
- 构造函数
- Coursera Machine Leaning 课程总结
- 6.4.12:命名HQL查询
- CF 5 C. Longest Regular Bracket Sequence
- 替代Apache Ant的最佳工具
- 8 Deadly Commands You Should Never Run on Linux