Reputation:
Is there a way to create a folder in SharePoint to create a folder using SharePoint REST APIs that it already had already configured permissions (broken inheritance and members can only read instead of contribute).
Basically, I need to make sure that when I show to user special folder in Documents Library it will already have correct permissions. If there are failures on the way, then it is better to not show that folder at all.
One way for me to achieve this (I believe) is to create a folder in some random place, configure permissions and then move it to Documents. I was wondering if there is a better way of doing this.
Upvotes: 0
Views: 3380
Reputation: 4208
It seems not a REST API to create folder and configuring permissions in 1 transactions.
We can to do it with two steps.
1.Create a folder using REST API.
Working with folders and files with REST
2.Set permission for this folder using REST API.
Folder level permission using REST api
Or as a workaround, we can create a custom REST service and using Server Side code to achieve this requirement, then consume this REST service from the client side. The following articles for your reference.
SharePoint 2013: Create a Custom WCF REST Service Hosted in SharePoint and Deployed in a WSP
Programmatically create folder in SharePoint List
How to Programmatically Set Permissions on Files/Folders in a SharePoint Document Library
Upvotes: 1