1

我为 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>

任何人都可以帮忙吗?

4

1 回答 1

0

搜索以下参考:

• 打开安装包的WebApplication的配置文件:C:\Inetpub\wwwroot\wss\VirtualDirectories[Port Web App]\web.config

• 查看出现在适当位置的以下两个应创建解决方案安装的配置条目:

 <SafeControl Assembly="TestActivity.TestSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c25d241f3e851927" Namespace="TestActivity.TestSite" TypeName="*" Safe="True" SafeAgainstScript="False" />

  <authorizedType Assembly="TestActivity.TestSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c25d241f3e851927" Namespace="TestActivity.TestSite" TypeName="*" Authorized="True" />

如果您没有在适当的地方手动添加它们。

然后验证该文件是 TestActivity.TestSite.Actions 进入适当的目录:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\Workflow\

于 2012-07-18T17:50:16.900 回答