VS2012 开发SharePoint 2013 声明式workflow action(activity)之 HelloWorld
2013-10-12 21:53
411 查看
本文讲述VS2012 开发SharePoint 2013 声明式workflow action 之 HelloWorld。
使用VS2012开发客户化的workflow action是SharePoint 2013 自带的action的一种补充,用于实现较为复杂的业务逻辑,需要它的理由有三:
1.满足客户复杂逻辑的定制化需求
2.可以由专业第三方的公司开发更多友好和适合特定行业的action库,以满足用户需求,有利于构件更完善的SharePoint 2013 生态系统
3. 代码和业务逻辑重用
下图是Custom activity 所处的SharePoint 2013 workflow 的体系结构中的位置:
接下来说明如何使用VS2012实现一个最简单的声明式workflow action (需求是接受一个message参数,将该message写到Workflow history list中,实际工作中肯定不会有这种需求,这里是举个简单的例子):
准备工作参考前一篇的准备工作:
/article/1786641.html
外加安装VS2012 + Office 2013 development tool
新建SharePoint 2013 solution
1.新建SharePoint 2013 empty solution(选择farm solution或sandbox solution均可)
2. 新建Custom action
3. 添加输入参数
4. 在Toolbox中搜索WriteToHistory,并拖拽至 HelloWorldAction中
5. 将输入参数HelloMessage设置为WriteToHistory的Message属性
6. 编辑HelloWorldAction.actions4, 绑定输入参数和RuleDesigner
7. 使用VS部署该解决方案
和
在SharePoint designer 2013中使用custom action
1. 清空SharePoint designer 2013 的cache文件 C:\Users\v-abchen\AppData\Local\Microsoft\WebsiteCache ,这是因为部署了新的action,否则使用SharePoint designer 2013 新建workflow时会出现如下错误:
Sever-side activities have been updated. You need to restart SharePoint designer to use the updated version of activities.
2.打开SharePoint designer 2013 新建一个命名为TestHelloWordAction 的site workflow
3.在新建的workflow 中加入HelloWorldAction
4.设置Message参数
5.给workflow添加结束语句,并发布
调试[b]custom action[/b]
1. 在VS2012的activity 上设置调试断点
2. 启动VS2012调试
3. 到 http://SP2013Site/_layouts/15/workflow.aspx 页面启动site workflow TestHelloWordAction
4. VS2012中的断点将被激活
5.按F5工作流完成后可以看到我们写入Workflow History 的HelloMessage
使用VS2012开发客户化的workflow action是SharePoint 2013 自带的action的一种补充,用于实现较为复杂的业务逻辑,需要它的理由有三:
1.满足客户复杂逻辑的定制化需求
2.可以由专业第三方的公司开发更多友好和适合特定行业的action库,以满足用户需求,有利于构件更完善的SharePoint 2013 生态系统
3. 代码和业务逻辑重用
下图是Custom activity 所处的SharePoint 2013 workflow 的体系结构中的位置:
接下来说明如何使用VS2012实现一个最简单的声明式workflow action (需求是接受一个message参数,将该message写到Workflow history list中,实际工作中肯定不会有这种需求,这里是举个简单的例子):
准备工作参考前一篇的准备工作:
/article/1786641.html
外加安装VS2012 + Office 2013 development tool
新建SharePoint 2013 solution
1.新建SharePoint 2013 empty solution(选择farm solution或sandbox solution均可)
2. 新建Custom action
3. 添加输入参数
4. 在Toolbox中搜索WriteToHistory,并拖拽至 HelloWorldAction中
5. 将输入参数HelloMessage设置为WriteToHistory的Message属性
6. 编辑HelloWorldAction.actions4, 绑定输入参数和RuleDesigner
<Action Name="HelloWorldAction" ClassName="HelloWorldAction.HelloWorldAction" Category="Custom" AppliesTo="all"> <RuleDesigner Sentence="Hello message is %1"> <!-- Define the UI widgets SharePoint designer should use for configuring this action --> <FieldBind Field="HelloMessage" Text="Hello message" Id="1" DesignerType="TextOnly" DisplayName="Hello message" /> </RuleDesigner> <Parameters> <Parameter Name="HelloMessage" Type="System.String, mscorlib" Direction="In" DesignerType="TextOnly" Description="Set the HelloMessage" /> </Parameters> </Action>
7. 使用VS部署该解决方案
和
在SharePoint designer 2013中使用custom action
1. 清空SharePoint designer 2013 的cache文件 C:\Users\v-abchen\AppData\Local\Microsoft\WebsiteCache ,这是因为部署了新的action,否则使用SharePoint designer 2013 新建workflow时会出现如下错误:
Sever-side activities have been updated. You need to restart SharePoint designer to use the updated version of activities.
2.打开SharePoint designer 2013 新建一个命名为TestHelloWordAction 的site workflow
3.在新建的workflow 中加入HelloWorldAction
4.设置Message参数
5.给workflow添加结束语句,并发布
调试[b]custom action[/b]
1. 在VS2012的activity 上设置调试断点
2. 启动VS2012调试
3. 到 http://SP2013Site/_layouts/15/workflow.aspx 页面启动site workflow TestHelloWordAction
4. VS2012中的断点将被激活
5.按F5工作流完成后可以看到我们写入Workflow History 的HelloMessage
相关文章推荐
- VS2012 开发SharePoint 2013 声明式workflow action(activity)之 HelloWorld
- SharePoint 2013 workflow 开发 SharePoint Designer 2013 vs. Visual Studio 2012
- SharePoint 2013开发VS 2012必备的插件
- SharePoint 2013开发VS 2012必备的插件
- VS2012、VS2013 WDK7.1驱动开发模板
- 使用Revit 2015+VS2013搭建开发环境并实现helloWorld插件的小例子
- 让您的 VS 2012/2013 升级开发 .NET 4.6 -- Targeting the .NET Framework 4.6 (多目标包)
- 使用VS2012 开发SharePoint 2013 声明式的action(activity) 综合实例
- 使用VS2012 开发SharePoint 2013 声明式的action(activity) 综合实例
- BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第3章节--SharePoint 2013 开发人员工具 使用Visual Studio 2012开发SharePoint
- VS2013的OSG开发环境配置
- [内核编程] VS2013 WDK8.1 开发,调试驱动(xp win7 亲测)
- VS2013 + Qt5.4.1 开发环境搭建
- VS2013搭建wxWidgets开发环境
- VS 2012 OpenGL 配置与实例开发
- Office 365 - SharePoint 2013 Online之加入App开发工具Napa
- win10中的VS2013配置OpenCV开发环境
- Vs2013在Linux开发中的应用(36):Milestone-0.1.0
- C语言入门(2)——安装VS2013开发环境并编写第一个C语言程序
- QT5+VS2013软件开发环境配置