通过调用REST API在列表项上启动工作流程

编程入门 行业动态 更新时间:2024-10-13 04:23:27
本文介绍了通过调用REST API在列表项上启动工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我读了一些文章,说我必须求助于

/_ api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId ='e90bdef8-209b-436b-acd7-b6ec01abb578',itemId ='109')

但无法正常工作,响应是

{错误":{代码":-2147024809,System.ArgumentException",消息":{"lang":"ru-RU",值" :"subscription""}}}

然后我尝试了

/_ api/SP.WorkflowServices.InteropService.Current/StartWorkflow(associationName ='WorkflowName',listId ='79e70851-4ea2-45cf-8c6f-06adc9f3f226',itemGuid ='bfdffb1b-e7e4-4363-9f8f- 04641575724f')

但是问题还是相似的

{错误":{代码":-2147024809,System.ArgumentException",消息":{"lang":"ru-RU",值" :" associationName"}}}

我看到它说参数有问题,但是我看不到任何错误...

有人能做到吗?谢谢你的建议

解决方案

以下代码供您参考.修改"subscriptionId".和"itemId"在下面的代码中,然后将代码添加到Web部件页面的内容编辑器Web部件中.

<脚本src ="//code.jquery/jquery-3.1.0.min.js" type ="text/javascript"></script> < script type =文本/javascript"> 函数StartWorkflow(){

.ajax({ 网址:_spPageContextInfo.siteAbsoluteUrl +``/_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='a158ae37-a4bb-4b80-9405-6db2aedc98af',itemId='2')',, 类型:"POST", contentType:"application/json; odata = verbose", 标头:{ "Accept":"application/json; odata = verbose", "X-RequestDigest":

("#__ REQUESTDIGEST").val() }, 成功:功能(数据){ alert('成功'); }, 错误:函数(数据){ alert(错误"); } }); } </script> <输入类型=按钮"; value ="StartWorkflow"; onclick =" StartWorkflow()"/>

最好的问候,

丹尼斯

I have read some articles that says that I have to resort to calling

/_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='e90bdef8-209b-436b-acd7-b6ec01abb578',itemId='109')

but can't make it work, the response is

{"error":{"code":"-2147024809, System.ArgumentException","message":{"lang":"ru-RU","value":"subscription"}}}

then I tried

/_api/SP.WorkflowServices.InteropService.Current/StartWorkflow(associationName='WorkflowName',listId='79e70851-4ea2-45cf-8c6f-06adc9f3f226',itemGuid='bfdffb1b-e7e4-4363-9f8f-04641575724f')

but again the problem is similar

{"error":{"code":"-2147024809, System.ArgumentException","message":{"lang":"ru-RU","value":"associationName"}}}

I see it says that the problem with parameters but I don't see any mistakes with them...

does anyone ever make it work? Thank for any advice

解决方案

Hi,

The following code for your reference. Modify the "subscriptionId" and "itemId" in the code below and then add the code into a content editor web part in the web part page.

<script src="//code.jquery/jquery-3.1.0.min.js" type="text/javascript"></script> <script type="text/javascript"> function StartWorkflow(){

.ajax({ url: _spPageContextInfo.siteAbsoluteUrl + "/_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='a158ae37-a4bb-4b80-9405-6db2aedc98af',itemId='2')", type: "POST", contentType: "application/json;odata=verbose", headers: { "Accept": "application/json;odata=verbose", "X-RequestDigest":

("#__REQUESTDIGEST").val() }, success: function (data) { alert('Success'); }, error: function (data) { alert("Error"); } }); } </script> <input type="button" value="StartWorkflow" onclick="StartWorkflow()"/>

Best Regards,

Dennis

更多推荐

通过调用REST API在列表项上启动工作流程

本文发布于:2023-11-28 12:37:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642427.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作流程   列表   REST   API

发布评论

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

>www.elefans.com

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