SharePoint工作流不会启动自动上载的文档(SharePoint workflow does not start for automatically uploaded documents)

编程入门 行业动态 更新时间:2024-10-27 10:19:02
SharePoint工作流不会启动自动上载的文档(SharePoint workflow does not start for automatically uploaded documents)

我有一个服务,可以自动将文档上载到SharePoint 2013文档库。 我创建了一个简单的工作流程,它在创建新项目时启动并只发送电子邮件通知; 但是,工作流程仅在我手动添加文档时启动,而不是在服务上载文档时启动。 提前感谢您提供有关如何解决问题的任何想法。

I have a service that automatically uploads documents to a SharePoint 2013 Document Library. I created a simple workflow that starts when a new item is created and just sends an email notification; however, the workflow only starts when I manually add a document and not when it's uploaded by the service. Thank you in advance for any ideas on how to resolve it.

最满意答案

如果已将工作流程附加到列表,则应自动触发工作流程。 我之前发现了一些这样的案例。 请检查[这里] [1]

[1]: https : //sharepoint.stackexchange.com/questions/62371/workflow-not-triggered-via-custom-webpart-but-works-if-add-item-from-ui 。

I had to add some code to start a workflow after the app does its stuff:

using Microsoft.SharePoint; using Microsoft.SharePoint.Workflow; static void StartWorkflow(SPListItem listItem, SPSite spSite, string wfName) { SPList parentList = listItem.ParentList; SPWorkflowAssociationCollection associationCollection = parentList.WorkflowAssociations; foreach (SPWorkflowAssociation association in associationCollection) { if (association.Name == wfName) { association.AutoStartChange = true; association.AutoStartCreate = false; association.AssociationData = string.Empty; spSite.WorkflowManager.StartWorkflow(listItem, association, association.AssociationData); } } }

更多推荐

本文发布于:2023-07-26 08:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1272892.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作流   文档   workflow   SharePoint   uploaded

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!