在简单SharePoint工作流中,SPWorkflowActivationProperties.Item为NULL [英] SPWorkflowActivationProperties.Item is NULL in Simple SharePoint Workflow

查看:138
本文介绍了在简单SharePoint工作流中,SPWorkflowActivationProperties.Item为NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用非常方便的 STSDEV工具 (这使我可以访问其他工具(例如VSeWSS 1.3)所必需的32位SharePoint安装权限.

I have generated a C# SharePoint Sequential Workflow project using the very handy STSDEV tool (it got me around the requirement to have access to a 32-bit SharePoint installation which is required for other tools such as VSeWSS 1.3).

我添加了一个简单的修改标题"操作来测试我的基本设置:

I've added a simple 'modify the title' action to test my basic setup:

public sealed partial class CopyWorkflow : SharePointSequentialWorkflowActivity
{

    public CopyWorkflow()
    {
        InitializeComponent();
        workflowProperties = new SPWorkflowActivationProperties();
    }

    public SPWorkflowActivationProperties workflowProperties;

    private void onWorkflowActivated1_Invoked_1(object sender, ExternalDataEventArgs e)
    {
        workflowProperties.Item["Title"] = workflowProperties.Item["Title"].ToString() + ": Processed by Workflow";
        workflowProperties.Item.Update();
    }
}

无论如何,在通过WSP将工作流安装到 WSS 3.0 的安装中,激活功能并将工作流配置为在为特定列表创建新项目时启动时,我得到了断点在onWorkflowActivated1_Invoked_1命中中,但 workflowProperties.Item始终为NULL,而不是代表刚刚添加的项目的SPListItem .

Whoever, after installing my workflow via WSP into an installation of WSS 3.0, activating the feature, and configuring the workflow to start whenever a new item is created for a particular list, I get my breakpoint in onWorkflowActivated1_Invoked_1 hit, but the workflowProperties.Item is always NULL instead of an SPListItem representing the item that was just added.

在调用此回调时,我需要怎么做才能填充项目?

What do I need to do to get the Item to be filled when this callback is called?

更新:我注意到执行工作流的线程正在匿名运行,而不是以登录用户或系统用户的身份运行,因此将无法访问列表数据.此外,SharePoint日志文件显示以下异常:

Update: I've noticed that the thread executing the workflow is running anonymously rather than as the logged in user or the system user, and therefore won't have access to the list data. Furthermore, the SharePoint log file show the following exception:

Unexpected System.ArgumentNullException: Value cannot be null. Parameter name: uriString at System.Uri..ctor(String uriString) at Microsoft.SharePoint.SPSite..ctor(String requestUrl) at Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties.<get_Site>b__0() at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state) at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties....

Unexpected ...get_Site() at Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties.get_Web() at Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties.get_Item() at BechtelWorkflow.CopyWorkflow.onWorkflowActivated1_Invoked_1(Object sender, ExternalDataEventArgs e) at System.Workflow.ComponentModel.Activity.RaiseGenericEvent[T](DependencyProperty dependencyEvent, Object sender, T e) at System.Workflow.Activities.HandleExternalEventActivity.RaiseEvent(Object[] args) at System.Workflow.Activities.HandleExternalEventActivity.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor'1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor'1.Execute(Activity activi...

推荐答案

您是否已将WorkflowActivationProperties与Workflow Designer绑定在一起?

Have you bound WorkflowActivationProperties with Workflow designer?

WorkflowActivationProperties http://img718.imageshack.us/img718/9703/ss20100305091353. png

这篇关于在简单SharePoint工作流中,SPWorkflowActivationProperties.Item为NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆