|
| 1 | +--- |
| 2 | +title: Manage list item and file permissions with Power Automate |
| 3 | +ms.date: 07/16/2020 |
| 4 | +--- |
| 5 | + |
| 6 | +# Manage list item and file permissions with Power Automate flows |
| 7 | +SharePoint connector in Power Automate provides the following actions to manage permissions of an individual list item in a list or a file in a document library. |
| 8 | +- Grant access to an item or a folder |
| 9 | +- Create sharing link for a file or folder |
| 10 | +- Stop sharing an item or a file |
| 11 | + |
| 12 | +All of the above actions let you customize permissions for the item or a file to allow the right users to access that item or the file. To grant access or stop sharing, you will need to be a list owner of that list or library. That means, in your flow for these actions, you must connect to the list or library using a list owner user account. |
| 13 | + |
| 14 | +## Grant access to an item or a folder |
| 15 | +The 'Grant access to an item or a folder' action requires the following inputs: |
| 16 | +- SharePoint site URL |
| 17 | +- List or library name or identifier |
| 18 | +- The item or the file identifier for which to grant access |
| 19 | +- The recipients whom you want to grant access |
| 20 | +- The permission role you want to grant |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +In the flow action, you can also include a message and choose to notify the recipients once they get access to the item or the file. |
| 25 | + |
| 26 | +> [!NOTE] |
| 27 | +> 'Grant access to an item or a folder' does not support granting access to external users. |
| 28 | +
|
| 29 | +### Choosing a permission role to grant access |
| 30 | +Depending on the user, you may want to grant them either access to edit or read. You can choose the right access in the Roles property. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +The permission roles map to [simplified standard SharePoint permission groups](https://docs.microsoft.com/en-us/sharepoint/modern-experience-sharing-permissions): |
| 35 | +- Members |
| 36 | +- Owners |
| 37 | + |
| 38 | +### Using custom-defined roles to grant access |
| 39 | +In advanced scenarios where you need to specify a custom-defined permission role, you can do so in the flow action by entering a custom value for the *Roles* property in the following format: |
| 40 | +``` |
| 41 | +roles:<role-id> |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +If you want to get the role id for the custom-defined role permission, you can do so by navigating to the SharePoint URL in your web browser and then search for that role. |
| 47 | +``` |
| 48 | +https://<your-sharepoint-site>/_api/web/roledefinitions |
| 49 | +``` |
| 50 | + |
| 51 | +For example: |
| 52 | +``` |
| 53 | +https://contoso.microsoft.com/teams/itweb/_api/web/roledefinitions |
| 54 | +``` |
| 55 | + |
| 56 | +You can find the role Id in the *category* property of an role item. |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +## Grant access using sharing links |
| 61 | +Instead of granting users access to files directly, you can provide access to a specific file using [shareable links](https://docs.microsoft.com/en-us/sharepoint/modern-experience-sharing-permissions#sharable-links). |
| 62 | + |
| 63 | +You can use the '[Create sharing link for a file or folder](https://docs.microsoft.com/en-us/sharepoint/dev/business-apps/power-automate/sharepoint-connector-actions-triggers#create-sharing-link-for-a-file-or-folder)' action to create shareable links for a given file. |
| 64 | + |
| 65 | +> [!NOTE] |
| 66 | +> 'Create sharing link for a file or folder' only supports files or folders in a document library. List items are not supported yet. |
| 67 | +
|
| 68 | + |
| 69 | + |
| 70 | +When creating a shareable link using the action, you can specify: |
| 71 | +- Link type |
| 72 | + - Type of sharing link - view and edit or view only |
| 73 | +- Link scope |
| 74 | + - Who gets access to the link - anyone with the link, including anonymous or people in your organization |
| 75 | + |
| 76 | +## Stop sharing an item or a file |
| 77 | +The 'Stop sharing an item or a file' action requires the following inputs: |
| 78 | +- SharePoint site address |
| 79 | +- List or library name or identifier |
| 80 | +- The item or the file identifier for which to stop sharing |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +Applying this flow action will reset all permissions except on that item or the file except for site owners. |
0 commit comments