在 EventReceiver 之后调用 SharePoint 工作流
我有一个关于共享点工作流程和事件接收器的问题。我有一个正在元素上设置元数据的事件接收器。之后,我使用工作流程将项目元数据复制到列表中。不幸的是,工作流不会复制事件接收器设置的元数据。我认为因为它是在事件接收器之前执行的。是否可以更改顺序,以便工作流在事件接收器之后执行?接收者以同步方式绑定到 ItemAdded 和 ItemUpdated 事件。
感谢您的帮助! 帕特里克
i got a question regarding sharepoint workflows and event receivers. i got an event receiver that is setting metadata on an element. after that, i use a workflow to copy item metadata to a list. unfortunately the workflow does not copy the metadata set by the event receiver. i think because it is executed before the event receiver. is there a possibility to change the order, so that the workflow will execute after the event receiver? the receiver ist bound to the ItemAdded and ItemUpdated Events i a syncrounous manner.
Thank you for your help!
Patrick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 SPWorkFlowAssociation 运行与 List 或 Content Type 关联的工作流。
示例(添加项目后运行工作流)
有关 SPWorkflowAssociation 的更多信息 检查以下链接
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowassociation.aspx
You can use SPWorkFlowAssociation to run workflow that associate with List or Content Type .
Example ( run workflow after adding item)
More information about SPWorkflowAssociation Check the below link
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowassociation.aspx
SPListItem:
“同步”事件(-ing 结尾如 ItemAdd*ing*)始终在工作流程之前执行。
“异步”事件(-ed 结尾,如 ItemAdd*ed*)始终在工作流程执行后执行。
因此,您必须将 Elements.xml 文件的“Synchronization”属性设置为“Synchronous”,并且工作流将始终在事件接收器之后执行。
注意:默认情况下,“添加”和“更新”事件异步运行,因此您必须在 Elements.xml 中进行更改。
SPListItem:
The "Synchronous" events (-ing ending like ItemAdd*ing*), are always executed before the workflow.
The "Asynchronous" events (-ed ending like ItemAdd*ed*), are always executed after the execution of the workflow.
So, you have to set the "Synchronization" property of the Elements.xml file equal to "Synchronous" and the workflow will always be executed after the event receiver.
ATTENTION: Events Added and Updated run asynchronously by default, so you have to do the change in the Elements.xml .