将工作流程令牌放入 sharepoint 中的自定义活动中
我正在尝试为我的共享点工作流程开发一个自定义活动,以简化一些事情。在其中我创建一个任务、日志、设置自定义工作流程状态 (setState) 和一些其他内容。
我遇到的问题是 setState 活动,它需要仅在主工作流程中可用的工作流令牌。我找到了以下博客文章: http ://blog.sharepoint.ch/2009/11/how-to-set-correlation-token-property.html 解释了如何创建一个属性,然后您可以将workflowToken分配给该属性并且效果很好我不知道如何将收到的令牌设置为 setState 活动?
在设计器中,看起来我不能,当我尝试以编程方式执行以下操作时:
private void setState_MethodInvoking(object sender, EventArgs e)
{
SetState s = (SetState)sender;
s.CorrelationToken = WorkflowToken;
}
在调用中,我收到以下错误:
This operation can not be performed at runtime. at System.Workflow.ComponentModel.DependencyObject.SetValueCommon(DependencyProperty dependencyProperty, Object value, PropertyMetadata metadata, Boolean shouldCallSetValueOverrideIfExists)
at System.Workflow.ComponentModel.DependencyObject.SetValu
有什么想法吗?
I am trying to develop a custom activity for my sharepoint workflow that would simplify some things. Within it I create a task, log, set a custom workflow status (setState) and some other things.
The problem I have is with the setState activity which needs the workflowToken that is available in main workflow only. I've found the following blog post: http://blog.sharepoint.ch/2009/11/how-to-set-correlation-token-property.html that explains how to create a property that you can then assign workflowToken to and that works well, however I don't know how can I then set this token that I receive to the setState activity?
In designer it looks that I can't and when I tried to do programmatically like this:
private void setState_MethodInvoking(object sender, EventArgs e)
{
SetState s = (SetState)sender;
s.CorrelationToken = WorkflowToken;
}
in the invoking call I get the following error:
This operation can not be performed at runtime. at System.Workflow.ComponentModel.DependencyObject.SetValueCommon(DependencyProperty dependencyProperty, Object value, PropertyMetadata metadata, Boolean shouldCallSetValueOverrideIfExists)
at System.Workflow.ComponentModel.DependencyObject.SetValu
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
呃,我完全忽略了这样一个事实:在我链接到的文章中答案已经存在:
在设置器中设置相关属性!那好吧!
Duh, I completely overlooked the fact that in the article I've linked to the answer is already there:
One sets the correlation property in the setter! Oh well!
相关标记应在设计时使用属性窗口 (F4) 在 Visual Studio 中绑定。
The correlation token should be bound at design-time in visual studio, using the properties window (F4).
环顾四周,为您提供一些更深入的信息,并发现以下内容 回答 MS 社区论坛上的类似问题。它解释了相关令牌是什么以及如何使用它:
Looked around a bit more to get you some more in depth info and found the following answer to a similar question on the MS community forums. It explains what the correlationToken is and how it is used: