sharepoint_SharePoint三态工作流陷阱

sharepoint

I used to be SharePoint evangelist in our company, so my Outlook always full of questions about how to do this, or where I can find that. One day I found such an email with the following question: "how to attach 3-State workflow (one of the workflows available "Out-of-the-Box") to the Wiki Library".

我曾经是我们公司的SharePoint宣传员,所以我的Outlook总是充满有关如何执行此操作或在哪里找到该问题的问题。 有一天,我发现了这样的一封电子邮件,其中包含以下问题:“如何将3-State工作流程(其中一种工作流程可用,即开即用”附加到Wiki库)。

Looks like a good idea for business users, especially if they need to control wiki content contribution. I have to mention that their department use small isolated SharePoint farm based on MOSS 2007 Standard.

对于业务用户而言,这似乎是个好主意,尤其是在需要控制Wiki内容贡献的情况下。 我不得不提到,他们的部门使用基于MOSS 2007 Standard的小型隔离SharePoint场。

As usual, I sent her simple step-by-step manual from the MS TechNet (or someone’s blog article, I don't remember the exact source).

和往常一样,我从MS TechNet(或某人的博客文章,我不记得确切的来源)发送了她简单的分步手册。

She has successfully attached workflow to the library, assigned column with state values, and managed to start the workflow without any problems. Although all the workflow instances she started have never been finished successfully. That became interesting for me so I visited her servers myself. After some diving into logs I found the following exception:

她已成功将工作流程附加到库,并为状态值分配了列,并成功启动了工作流程而没有任何问题。 尽管她启动的所有工作流程实例从未成功完成。 这对我来说变得很有趣,所以我亲自访问了她的服务器。 深入日志后,我发现以下异常:

System.ArgumentException: Value does not fall within the expected range.     
at Microsoft.SharePoint.SPFieldCollection.GetField(String strName, Boolean bThrowException)     
at Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException)     
at Microsoft.SharePoint.SPListItem.GetValue(String strName)     
at Microsoft.SharePoint.SPListItem.get_Title()     
at Microsoft.SharePoint.Workflow.Application.IssueTracking.OnWorkflowActivated(Object sender, EventArgs 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 activity, ActivityExecutionContext executionContext)     
at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)     
at System.Workflow.Runtime.Scheduler.Run()

Looks like Microsoft.SharePoint.SPListItem.get_Title()  is a root of evil. I opened SharePoint DLL with a Reflector (pretty useful tool, especially for SharePoint specialist) and found the following code:

看起来像Microsoft.SharePoint.SPLis tItem.get_ Title()是邪恶的根源。 我用反射器(非常有用的工具,特别是对于SharePoint专家)打开了SharePoint DLL,发现以下代码:

 
public string get_Title()
{
    object obj2 = this.GetValue("Title");
    if (obj2 != null)
    {
        return (string) obj2;
    }
    return string.Empty;
}

Gotcha! There is no "Title" column in a default Wiki template. And reference to this column is perfectly hardcoded to the 3-State workflow code. Actually not sure why. Thus we just added a new column with this name and now it works well... Although we never assign any value to that field, you probably want to set something more meaningful, so you can create Title field as calculated and use formula to grab page name or any existing data.

知道了! 默认的Wiki模板中没有“标题”列。 对此专栏的引用完全硬编码为3状态工作流代码。 其实不确定为什么。 因此,我们只是用这个名称添加了一个新列,现在它可以正常工作了……尽管我们从未为该字段分配任何值,但是您可能希望设置一些更有意义的内容,因此您可以将计算出的“标题”字段创建为计算字段并使用公式来获取页面名称或任何现有数据。

At least she hasn’t contacted me again on this :)

至少她还没有再与我联系:)

PS : Please note that you can meet the same issue when you try to attach OOTB 3-State workflow to the Library with no "Title" column!

PS:请注意,当您尝试将OOTB 3-State工作流附加到库时没有“标题”列时,您可能会遇到相同的问题!

Hope you find this Article helpful - and dont forget to vote :)

希望本文对您有所帮助-别忘了投票:)

翻译自: https://www.experts-exchange.com/articles/5355/SharePoint-3-State-Workflow-Trap.html

sharepoint

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值