I have a group of users with edit without delete permission. And I am creating an approval workflow that allows these users to request for the deletion of files. The flow starts well once the admin accepts the request it throughs error on Delete file action (Access denied. You do not have permission to perform this action or access this resource. clientRequestId:)
-
Is it Power-automate workflow? If so, check the SharePoint connection used in the workflow. The user account used to connect to SharePoint should have delete file permission.– Matiur RahmanCommented Oct 5, 2020 at 3:27
-
@MatiurRahman Yes, it is a power automate workflow. The user has edit without delete permission. But the user just submits a request for deleting a file through an instant workflow. Is not it possible to use the approval account for the deletion action?– Fatimah MohmmedCommented Oct 5, 2020 at 3:57
-
How the Workflow gets triggered? On Delete of the file or On Change of the File Meta Data?– Matiur RahmanCommented Oct 5, 2020 at 12:12
-
the user selects a file and sends it as a request for deletion approval (select a file> automate> choose the deletion flow). So, the trigger starts with (For a file selected)– Fatimah MohmmedCommented Oct 6, 2020 at 5:13
-
@MatiurRahman I updated my question and added an image of the workflow, please check.– Fatimah MohmmedCommented Oct 6, 2020 at 5:39
3 Answers
In the delete file action, the connection you choose should have enough permission in the site collection. Please check.
-
Yes, you are right, To perform the deletion action, the user must have deletion permission. But I want the approval of the workflow (which has deletion permission) to do the action of deletion inside the flow instead of the requester. Commented Oct 14, 2020 at 8:02
-
Have you checked the connection for the delete file action? Commented Oct 15, 2020 at 8:48
-
Yes, I have checked the connection for SharePoint, I added (run only users) I changed it to my connection credential and it worked like a Charm. Commented Oct 15, 2020 at 9:56
I couldn't reproduce your scenario. But the following scenario worked for me.
SharePoint
- The SharePoint Doc Library has a column named [Status] with choices: Approve, Complete, and Delete. The users, who don't have permission to delete documents from this library, will submit a deletion request by changing the status of the document to "Delete"
- A MS Flow/Power Automate, When an item is created or modified, will starts since status being modified
- Within the flow, if the condition is met, the request is sent to the approver defined in the Flow, and will act on the request (Approve or Reject). If approved, document is deleted from the library using "Delete file" action in the Flow.
MS Flow/Power Automate
The Flow uses a SharePoint Connection with a user account that has permission to delete documents from the library.
Screenshots showing actions that worked
In my case, the approver user doesn't have document Delete permission But the SharePoint connector user does have Delete permission
-
This is the problem, I gave the user (edit without delete) permission. But I want them to perform a deletion action through the workflow. Is there a way users can gain access to delete using the workflow? Commented Oct 7, 2020 at 5:33
-
"Delete file" action in the Flow is controlled by the SharePoint Connector in your flow. That is, when Flows run, the user defined in the SharePoint Connection will perform the deletion. If the connector user has permission to delete file then it will succeed, if not, it will fail. How are you envisioning user deleting files from the Flow? Can you give an example? Commented Oct 7, 2020 at 12:29
-
As I mentioned before that users have (edit without delete) permission. When they request for deletion the manager will approve/reject. If he approved the file will be deleted (the deletion action should be performed with the approver account in SharePoint). Commented Oct 13, 2020 at 6:25
-
Does your error message show any user account that is not allowed to delete files? I'm using a different trigger, but will see if I can reproduce it with [For a select file} trigger Commented Oct 13, 2020 at 12:09
-
Yes, the error shows the user id requester, that his not authorized to perform the action. Commented Oct 14, 2020 at 7:56
I've tested exactly how your workflow is designed. However, couldn't reproduce the error. The only question now I have is how your flow is being triggered? I've added a column and added JSON format string to trigger the flow. Could you describe how are you triggering the flow?
JSON used to trigger "For a selected file"
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Request Deletion",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"0e7a1b3f-c4e6-4840-bfe5-e80b1c283e2e\"}"
}
}
SharePoint/Flow User Conditions
- The users requesting deletion doesn't have Delete permission, but has Edit permission
- The users approving the deletion doesn't have Delete permission
- The flow is running with the Owner account, that is, who developed the Flow This Flow Owner has Full Control permission to the library
-
My flow triggered when the user selects a file then click on Automate> select the deletion flow. The flow I have created is similar to yours, except for starting the trigger. I am so surprised how it works for you where the requester is not having deletion permission? Commented Oct 15, 2020 at 5:39
-
I solved the problem by changing the run only users to my connection, I like your idea of adding the button rather than trigger by automating option. Commented Oct 15, 2020 at 9:58