博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Granting and Managing Item Level Permission using SharePoint2013 Designer Workflow
阅读量:4578 次
发布时间:2019-06-08

本文共 2710 字,大约阅读时间需要 9 分钟。

Granting permission to the user by SharePoint 2013 designer workflow is different from SharePoint 2010.

we are using the Rest API to grant the permission as follows.

Create the Workflow and assign permission

  • Open the site in SharePoint 2013 designer and select the list for which workflows needs to be created and click new option,

Create Workflows 1

  • Specify the name of the workflow and click ok ,

Create Workflows 2

  • Add the action build the dictionary ,

Create Workflows 3

  • After adding the actions create the headers for REST api call as follows,

Create Workflows 4

  • Click the link this and create the following two variables
Name Type Value
Accept String application/json;odata=verbose
Content-Type String application/json;odata=verbose

 

 

 

 

 

 

  • Create the following local variables by clicking the local variables link in top ribbon,

Create Workflows 5

 

Name Type
responseContent Dictionary
responseHeaders Dictionary
responseCode String
requestHeaders Dictionary

 

 

 

 

 

 

 

  • Now set the requestHeaders variable to the outcome variable of dictionary builded.
  • Then add the Call Http web service action,

Create Workflows 6

  • Right click the above action and configure the properties as follows,

Create Workflows 7

  • Add the following URL in above action and select the HTTP method as POST as follows,

“{SiteURL}/_api/web/lists/getbytitle(‘Sample’)/items(1)/breakroleinheritance(true)”

Create Workflows 8

  • The above http call will stop inheritance of permission for the item with id 1.
  • After that add one more Call http web service action, configure the same properties as same as previous action.
  • Now configure the following URL in Enter Http web service URL and specify the method as HTTP Post,

“{SiteURL}/_api/web/lists/getbytitle(‘Sample’)/items(1)/roleassignments/addroleassignment(principalid=12,roleDefId=1073741926)”

  • In this Principal ID is the Id of the User to whom we need to grant permission and roledefinition Id is the permission level Id which can identified using the following URL

“{SiteURL}/_api/web/roledefinitions”

Create Workflows 9

  • That’s it , while running this workflow the REST api call will break the inheritance role for the particular item and grant the specified permission level (RolDefId) for the user .

Removing the Permission of Specified user

  • For removing the permission of the user in particular item, we need to design workflow as same as above for granting permissions.
  • Similarly same HTTP action to be called to break the role inheritance and call one HTTP action with the below URL,

{SiteURL}/_api/web/lists/getbytitle(‘Sample’)/items(1)/roleassignments/getbyprincipalid(12)

Get by principal ID is the ID of the User.

  • Then select the HTTP method as delete

Create Workflows 10

  • Now running the above workflow it will fill stop inheriting the permission and the second web service call will remove the permission for the user with ID 12.

 

原文地址:

 

转载于:https://www.cnblogs.com/bjdc/p/10942720.html

你可能感兴趣的文章
静态库和动态库
查看>>
移位寄存器
查看>>
java环境变量配置
查看>>
Win32K里的死循环
查看>>
C ++ 插入迭代器
查看>>
python修改字典的值(update map value)
查看>>
iOS6开发----应用集合视图(UICollectionView)-创建基于Storyboard的集合视图应用程序...
查看>>
详解EBS接口开发之更新供应商付款方法
查看>>
《java入门第一季》之ArrayList集合小案例
查看>>
python之路——函数(进阶)
查看>>
node.js---sails项目开发(2)
查看>>
Atom常用插件、快键键、使用技巧
查看>>
20150630 学习笔记
查看>>
欢迎来到我们的博客
查看>>
IT修养-基础篇
查看>>
从一个新手容易混淆的例子简单分析C语言中函数调用过程
查看>>
Core Java(五)
查看>>
django-csrf_exempt
查看>>
MVC系列1-MVC基础 (ASP.NET)
查看>>
一篇学术论 文投稿的所有流程是怎样的?
查看>>