如何使用sharepoint Web服务调用sharepoint工作流

时间:2014-03-21 18:37:15

标签: sharepoint sharepoint-workflow

我有一个asp.net Web应用程序,可以使用sharepoint Web服务将数据插入到sharepoint库中。插入数据后,如何触发与库关联的工作流程。

如果我不能以这种方式触发工作流程,那么我必须将文档上传到Type列,然后它将触发工作流程。

1 个答案:

答案 0 :(得分:0)

调用此函数传递指定的参数:

    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);
            }
        }
    } 

您还需要

using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;

它适用于我的VS应用程序。