我为 SP Designer 开发了一个 SP 工作流活动。部署成功。在 webconfig 文件中,authorizedType 已正确插入:
<authorizedType Assembly="WorkflowActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c8e215f3e395427" Namespace="AdventureWorksWFs" TypeName="*" Authorized="True" />
源代码:
public static DependencyProperty TestProperty = DependencyProperty.Register("Test", typeof(string), typeof(TestSite));
[Description("Name of the new Site")]
[Category("Sites")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string Test
{
get
{
return ((string)(base.GetValue(TestSite.TestProperty)));
}
set
{
base.SetValue(TestSite.TestProperty, value);
}
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
using (SPSite siteCollection = new SPSite(Url))
{
using (SPWeb web = siteCollection.OpenWeb())
{
using (SPWeb testWeb = web.Webs.Add(Test))
{
testWeb.Description = "This is a test!";
testWeb.Title = Test;
}
}
}
return ActivityExecutionStatus.Closed;
}
这是 .actions 文件:
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="Create New Site" ClassName="TestActivity.TestSite"
Assembly="TestActivity, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=5c25d241f3e851927" AppliesTo="all"
Category="Sites">
<RuleDesigner Sentence="Create TestSite">
<FieldBind Field="Test" Text="test" DesignerType="TextBox" Id="1" />
</RuleDesigner>
<Parameters>
<Parameter Name="Test" Type="System.String, mscorlib" Direction="In" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>
任何人都可以帮忙吗?