1

What I want to do

Im trying to write a software that is able to remove write permissions from all unsers for a file or folder so noone can modify/delete/overwrite the file.

What I already did

I know how to assign groups and permissions to a file. My Problem is, that I need the permissions based on the file's location. To make it easier, I dont have to use the filepath but can use the permission. Our sharepoint is set up in the following way:

Folder:

Root
-Marketing
-IT
--Development
--ServiceDesk
...

Permission-Groups:

Marketing
IT

All users in the group Marketing have access (Role: Edit) to all folders/files beneath Marketing. The same with IT and others. My idea is to get a file/folder, read all permissions/groups, remove the current roles and add them again with readonly.

My Problem

I cant find a way to get all groups that have permission to a file.

My Questions

How can I get all Groups from one file (if possible with their role)? Is there a better way to achieve what I want to do?

  • In SharePoint, you can manage permissions at the item level. This includes folders, documents, and list items. In your library, select the item, then look in the ribbon for Document Permissions. This will show you all the users and groups that have access to the document. Also, you can use a simple SharePoint Designer workflow to manage permissions. – Taco_Buffet Jan 20 '16 at 14:51
  • I have to write an application for this taks. There is no other way. Also afaik workflows cant change permissions. – Simon Balling Jan 20 '16 at 15:22
  • SharePoint Designer workflows can change permissions on items. Where will your application run? Directly on the server, client desktop, another web app? Also, what version of SharePoint are you working with. – Taco_Buffet Jan 20 '16 at 16:19
  • The application will run on a client desktop in the same environment. Im working with sharepoint 2013. A workflow wont work in most cases because i need to change multiple files at once. – Simon Balling Jan 20 '16 at 16:25
  • I testet the workflow method. You are right. I can change the permissions. But this wont solve my problem. I have to replace the permission only for the groups that already have permissions for this item. And that afaik cant be achieved using workflows. – Simon Balling Jan 21 '16 at 8:27
0

Using the SharePoint Rest API, you can set the permissions of the list/library, item, or folder.

This links will guide you through the process.

How to: set unique permissions for a File via REST: Manage File permissions using REST API

Users, groups, and roles REST API reference: https://msdn.microsoft.com/en-us/library/office/dn531432.aspx

If you are working directly on a SP server, PowerShell is another tool you can use to work with list/library items. http://www.sharepointed.com/2012/12/27/use-powershell-to-update-item-permssions-in-sharpoint/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.