Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

REST to change item permission

$
0
0

Hi, I have a SPD 2013 workflow and I want to change the permission of un specific document in a specific Document Library.

I could call a SPD 2010 to do it if I knew on advance the name of the Document Library, but it can be any in the site. Unfortunatelly SPD 2010 don't give you the option to get your Document Library name from a parameter, you pick it from a dropdown list.

Therefore I chose to use REST, to test the REST url I am using Advanced REST Client extension in Google Chrome, but when I type the URL using the method POST I dont see any change :

URL1: https://xxx/_api/web/getfilebyserverrelativeurl('/ADP_WorkflowSPD_DocLib/Document.docx')/breakroleinheritance(copyRoleAssignments=true,clearSubscopes=true)

URL2: https://xxx/_api/web/getfilebyserverrelativeurl('/ADP_WorkflowSPD_DocLib/Document.docx')/roleassignments/addroleassignment(principalId=30,roleDefId=1073741829) 

When I use "Call HTTP Web Service" to retrive the document with method GET, I get statusCode = OK
URL: https://xxx/_api/web/getfilebyserverrelativeurl('/ADP_WorkflowSPD_DocLib/Document.docx')

But when I use the same document and try to change it's permission, I get statusCode = NotFound
URL: https://xxx/_api/web/getfilebyserverrelativeurl('/ADP_WorkflowSPD_DocLib/Document.docx')/breakroleinheritance(copyRoleAssignments=true,clearSubscopes=true)
URL: https://xxx/_api/web/getfilebyserverrelativeurl('/ADP_WorkflowSPD_DocLib/Document.docx')/roleassignments/addroleassignment(principalId=30,roleDefId=1073741829)

Any help how to change an item permission using SPD 2013 and REST will be great, or even if there is a way to chose my own list using a variable in SPD 2010.

thanks



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>