.ACTIONS
文件路径:
|
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\2052\Workflow\
|
节点名称
|
父节点
|
含义
|
<WorkflowInfo>
|
无
|
头节点
|
<Actions>
|
<WorkflowInfo>
|
|
<Action>
|
<Actions>
|
定义工作流操作
|
<RuleDesigner>
|
<Action>
|
具体操作中显示的信息,已经参数位置
|
<FieldBind>
|
<RuleDesigner>
|
控制
Designer
中操作显示的信息,以及参数默认类型默认文本
|
<Option>
|
<FieldBind>
|
可自定义
FielBind
内的值
|
<Parameters>
|
<Action>
|
定义对应程序集属性的参数集
|
<Parameter>
|
<Parameters>
|
参数与引用程序集对应的信息,如类型、名称等
|
属性
|
含义
|
属性
|
含义
|
Sequential
|
|
Parallel
|
|
属性
|
含义
|
Name
|
操作的名称
|
ClassName
|
引用的程序集
|
Assembly
|
程序集信息(集名、版本、
Culture
、公钥)
|
AppliesTo
|
|
Category
|
在
Designer
中的操作选择项中的类表(自定义)
|
属性
|
含义
|
Sentence
|
选择操作以后显示的信息,如果句子有参数,在需要加参数的地方插入
[
%
+
数字
]
,如:
%1
|
属性
|
含义
|
Field
|
参数名称
|
DesignerType
|
定义
Designer
输入参数的方式
|
Text
|
默认显示的文本
|
Id
|
对应父节点
Sentence
属性中的参数编号,如:对应父节点的
%1
则
id=”1”
|
属性
|
含义
|
属性
|
含义
|
Name
|
参数名称,必须与引用程序集中声明的属性同名
|
Type
|
参数在
Designer
中的默认值
|
Direction
|
定义变量是输出还是输入,值为
”Out”
、
“In”
、
” Optional”
|
参数名
|
含义
|
|
|
参数名
|
含义
|
|
|
参数名
|
含义
|
ParameterNames
|
|
ChooseListItem
|
|
ListNames
|
|
ChooseDoclibItem
|
|
TextArea
|
|
FieldName
|
|
Stringbuilder
|
|
Operator
|
|
Integer
|
|
Dropdown
|
|
Date
|
|
Email
|
|
参数名
|
含义
|
In
|
|
Out
|
|
Optional
|
|
<?
xml
version
=
"1.0" encoding="utf-8" ?>
<
WorkflowInfo
>
<
Actions
Sequential
=
"then" Parallel="and">
<
Action
Name
=
"
从用户中获取名称
"
ClassName
=
"MyCustomActivity.EventLogger"
Assembly
=
"MyCustomActivity.EventLogger, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0d31bafc5a063039"
AppliesTo
=
"all"
Category
=
"
自定义工作流操作
">
<
RuleDesigner
Sentence
=
"
将 %1 转化为 %2
">
<
FieldBind
Field
=
"UserName" DesignerType="parameterNames" Text="
名称
" Id="1" />
<
FieldBind
Field
=
"UserLoginName" DesignerType="parameterNames" Text="
工程师帐号
" Id="2" />
</
RuleDesigner
>
<
Parameters
>
<
Parameter
Name
=
"__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In"/>
<
Parameter
Name
=
"UserName" Type="System.String, mscorlib" Direction="In" />
<
Parameter
Name
=
"UserLoginName" Type="System.String, mscorlib" Direction="Out" />
</
Parameters
>
</
Action
>
</
Actions
>
</
WorkflowInfo
>
|
public
static DependencyProperty LoginNameProperty =
System.Workflow.ComponentModel.DependencyProperty.Register("LoginName",typeof(string),typeof(Activty1));
[Category("
自定义工作流操作"
), Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public
string LoginName{
get{
return ((string)(base.GetValue(LoginNameProperty)));
}
set{
base.SetValue(LoginNameProperty, value);
}
}
|
public
static DependencyProperty NameProperty =
System.Workflow.ComponentModel.DependencyProperty.Register("Name", typeof(string), typeof(Activty1));
[Category("
自定义工作流操作"
), Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public
string Name{
get{
return ((string)(base.GetValue(NameProperty)));
}
set{
base.SetValue(NameProperty, value);
}
}
|
public
static DependencyProperty __ContextProperty =
DependencyProperty
.Register("__Context", typeof(WorkflowContext), typeof(EventLogger));
[ValidationOption(ValidationOption.Required)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public
WorkflowContext __Context{
get{
return (WorkflowContext)base.GetValue(__ContextProperty);
}
set{
base.SetValue(__ContextProperty, value);
}
}
|
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI
|
gacutil /i DLL
在本机的路径
|
protected
override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext){
try{
//
定义 SPUserCollection 从 __Context 中获取MOSS站点所有用户信息
SPUserCollection spUserCollection = __Context.Web.AllUsers;
//
定义 foreach 循环
foreach (SPUser spUser in spUserCollection){
//
判断对比用户的登录帐号
if (spUser.LoginName == LoginName){
//
将用户的姓名存储到 NameProperty 属性中
base.SetValue(NameProperty, spUser.Name);
break;
}
}
}
catch(){}
return
ActivityExecutionStatus.Closed;
}
|
sn �CT DLL
路径
|
gacutil /i DLL
路径
|
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\2052\Workflow\
|
<?
xml
version
=
"1.0" encoding="utf-8" ?>
<
WorkflowInfo
>
<
Actions
Sequential
=
"then" Parallel="and">
<
Action
Name
=
"
从用户帐号获取用户名字
"
ClassName
=
"ActivityLibrary1.ActivityLibrary1"
Assembly
=
"ActivityLibrary1.ActivityLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=DLL
的PublicKeyToken
"
AppliesTo
=
"all"
Category
=
"
自定义工作流操作
">
<
RuleDesigner
Sentence
=
"
从 %1 获取 %2
">
<
FieldBind
Field
=
"LoginName" DesignerType="
SinglePerson
" Text="
帐号
" Id="1" />
<
FieldBind
Field
=
"Name" DesignerType="parameterNames" Text="
名字
" Id="2" />
</
RuleDesigner
>
<
Parameters
>
<
Parameter
Name
=
"__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In"/>
<
Parameter
Name
=
"LoginName" Type="System.String, mscorlib" Direction="In" />
<
Parameter
Name
=
"Name" Type="System.String, mscorlib" Direction="Out" />
</
Parameters
>
</
Action
>
</
Actions
>
</
WorkflowInfo
>
|
<
authorizedType
Assembly
=
" ActivityLibrary1.ActivityLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken= DLL
的PublicKeyToken
" Namespace=" ActivityLibrary1" TypeName="*" Authorized="True" />
|
Iisreset /noforce
|