SharePoint2010QuickFlow安装及使用
2024-09-04 14:58:37
一:QuickFlow的安装
1,从http://quickflow.codeplex.com/下载解决方案包以及设计器。
2,将QuickFlow.dll以及QuickFlow.UI.dll添加到程序集引用。
3,将QuickFlow2010.wsp部署到站点上并激活。
4,创建一个任务列表,用来存储工作流运行后的历史。
二:QuickFlow的使用
1,发布工作流;
选择File—Publish to SharePoint—
2,创建变量;
3,给变量赋值;
在开始节点的AfterRule里面给该变量赋值
4,搜集了一些工作流中常用到的代码。
//获取列表项的Id
string itemId =this.GetVariable("ListitemID").ToString();
//获取列表
SPList cfgList = this.Web.Lists["项目备案信息"];
//获取一条数据
var cfgItem = cfgList.GetItemById(Convert.ToInt32(itemId));
//给申请人变量赋值
SPFieldUserValue ProjectUser= cfgItem.Fields.GetField("ProjectUser").GetFieldValue(cfgItem["ProjectUser"].ToString()) as SPFieldUserValue;
//this.SetVariable("人员", ProjectUser.User.LoginName);
//给项目区域赋值
SPFieldLookupValue proprovince=cfgItem.Fields.GetField("ProjectProvince").GetFieldValue(cfgItem["ProjectProvince"].ToString()) as SPFieldLookupValue ;
this.SetVariable("项目区域",proprovince.LookupValue);
//给项目大区赋值
SPFieldLookupValue probigZone=cfgItem.Fields.GetField("BigZone").GetFieldValue(cfgItem["BigZone"].ToString()) as SPFieldLookupValue ;
this.SetVariable("项目大区",probigZone.LookupValue);
//给项目战区赋值
SPFieldLookupValue proWarZone=cfgItem.Fields.GetField("WarZone").GetFieldValue(cfgItem["WarZone"].ToString()) as SPFieldLookupValue ;
this.SetVariable("项目战区",proWarZone.LookupValue); //到员工信息表中查询总经理
QueryField qfloginname=new QueryField("LoginName");
QueryField headManager=new QueryField("Role"); SPList cfgListEmploy = this.Web.Lists["员工信息"];
//获取一条数据
SPListItemCollection cfgItemhead=ListQuery.From(cfgListEmploy).Where(headManager=="总经理").GetItems(); if(cfgItemhead.Count>)
{
this.SetVariable("总经理",cfgItemhead[]["LoginName"]);
} //获取一条数据
var cfgItemEmploy = ListQuery.From(cfgListEmploy).Where(qfloginname==ProjectUser.User.LoginName).GetItems()[];
if(cfgItemEmploy!=null)
{ this.SetVariable("人员",cfgItemEmploy["Title"]); //给人员区域赋值
SPFieldLookupValue provinceEmploy=cfgItemEmploy.Fields.GetField("Province").GetFieldValue(cfgItemEmploy["Province"].ToString()) as SPFieldLookupValue;
this.SetVariable("人员区域",provinceEmploy.LookupValue); //给人员大区赋值
SPFieldLookupValue BigZoneEmploy=cfgItemEmploy.Fields.GetField("BigZone").GetFieldValue(cfgItemEmploy["BigZone"].ToString()) as SPFieldLookupValue;
this.SetVariable("人员大区",BigZoneEmploy.LookupValue); //给人员战区赋值
SPFieldLookupValue WarZoneEmploy=cfgItemEmploy.Fields.GetField("WarZone").GetFieldValue(cfgItemEmploy["WarZone"].ToString()) as SPFieldLookupValue;
this.SetVariable("人员战区",WarZoneEmploy.LookupValue);
//给申请人上级经理赋值
SPFieldUserValue TopManager= cfgItemEmploy.Fields.GetField("Manager").GetFieldValue(cfgItemEmploy["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("申请人上级经理", TopManager.User.LoginName); //到大区表中查询数据
SPList cfgListBigZone = this.Web.Lists["大区"];
//获取一条数据 var cfgItemUserBigZone = cfgListBigZone.GetItemById(BigZoneEmploy.LookupId);
var cfgItemProBigZone = cfgListBigZone.GetItemById(probigZone.LookupId);
//给申请人大区经理赋值
if(cfgItemUserBigZone!=null)
{
SPFieldUserValue UserBigZoneManager= cfgItemUserBigZone.Fields.GetField("Manager").GetFieldValue(cfgItemUserBigZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("申请人大区经理",UserBigZoneManager.User.LoginName); }
//给项目大区经理赋值
if(cfgItemProBigZone!=null)
{
SPFieldUserValue ProBigZoneManager= cfgItemProBigZone.Fields.GetField("Manager").GetFieldValue(cfgItemProBigZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("项目大区经理", ProBigZoneManager.User.LoginName); }
//到战区表中查询数据
SPList cfgListwarZone = this.Web.Lists["战区"]; //获取一条数据
var cfgItemUserWarZone=cfgListwarZone.GetItemById(WarZoneEmploy.LookupId);
var cfgItemProWarZone=cfgListwarZone.GetItemById(proWarZone.LookupId); if(cfgItemUserWarZone!=null)
{
//给申请人战区经理赋值
SPFieldUserValue UserWarZoneManager= cfgItemUserWarZone.Fields.GetField("Manager").GetFieldValue(cfgItemUserWarZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("申请人战区经理", UserWarZoneManager.User.LoginName);
}
if(cfgItemProWarZone!=null)
{
//给项目战区经理赋值
SPFieldUserValue ProWarZoneManager= cfgItemProWarZone.Fields.GetField("Manager").GetFieldValue(cfgItemProWarZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("项目战区经理", ProWarZoneManager.User.LoginName);
} }
最新文章
- 【Python实战】Django建站笔记
- C# DateTime 格式化 奇怪问题!
- Highcharts使用
- NoSQL学习——MongoDB
- [转]Stop Sharing Session State between Multiple Tabs of Browser
- 在多线程环境中使用CoreData
- QC学习二:QC使用中问题点汇总
- delphi函数调用约定
- mybatis随意sql语句
- docke 网络配置
- ios 网络数据下载和JSON解析
- AVFoundation 框架初探究(一)
- [Swift]LeetCode763. 划分字母区间 | Partition Labels
- eclipse部分常用快捷键
- ansible常用命令
- sed memo 2
- 利用SVD-推荐未尝过的菜肴
- vs2015 编译google v8
- mysql 存储过程用程序调的问题
- oaf 动态创建table vo (转)