web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete a permission on...
Power Automate
Unanswered

Delete a permission on a sharepoint document library - Can not find the principal with id

(0) ShareShare
ReportReport
Posted on by 6

Hi All!

 

I've a powerautomate flow that has to delete a users permission from a sharepoint folder based on the users email address. 

 

I've created a GET request to get the users principal ID as below:
GET request to get the user principal IDGET request to get the user principal ID

Than i have some steps to extract the principal ID.

 

And finally i have a step which should delete the permission based on the principal ID got above. It looks like this:
DELETE request based on Principal IDDELETE request based on Principal ID

 

However when i run it it gives the following results:

 

1) Principal ID is got successfully:
Principal ID is OKPrincipal ID is OK

 

2) Delete request is not working. Error: Can not find the principal with id

Can not find the principal with idCan not find the principal with id

 

When i was looking for a solution i found this exact solution everywhere... Why is it just not working for me? The permission for the specified email address is surely given to the folder. The user for who the permission is given is an externaly user, idk if this has to do sg with the problem. 

 

Can you please help me solve this issue.. its very annoying.

 

Thank you so much!

Ruben

Categories:
  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    @RubenKocsis ,

    The Id wouldn't suffice. Follow this blog that nicely explains how to work with Principal Ids and Role defs using REST APIs.

    SharePoint Online REST APIs (Part VI): Permissions – SharePointCass

     

  • RubenKocsis Profile Picture
    6 on at

    Thanks @SudeepGhatakNZ but I can not find how to delete permission from a document library in your link. What i find is how to get the Principal ID, but that is not a problem for me. 

     

    Can you please provide a solution in more detail?

     

    Thanks,

    Ruben

  • RubenKocsis Profile Picture
    6 on at

    @SudeepGhatakNZ I have found why it is running on error... It is because external users with sharing links are not listed in the RoleAssignments. How could I get all the sharing links and their assignee-s? And then How could i revoke one assignee from a sharing link with HTTP rest api?

  • aakashmarasini Profile Picture
    39 on at

    @RubenKocsis Have you solved your issue? I am having the same issue as yours.

    I have implemented the workflows as below:

    aakashmarasini_0-1706699117370.png
    In my case, For retrieving the Id I am using the email:   _api/web/SiteUsers/getByEmail(<emailID>)
    The output of Action for delete Permission is as follows:

    aakashmarasini_0-1706699795577.png

    I am getting the error: "Can not find the principal with id: 14".

    I could not find a reason why Delete Request is not working.

  • RubenKocsis Profile Picture
    6 on at

    Hi @aakashmarasini 

     

    Sadly no. There is no solution for deleting sharing link assignee-s. No Graph Api solution, no HTTP request, nothing.... 

     

    So i ended up doing that part manually 😞 Maybe in the future MS will implement this solution. 

     

    However if the permission is not given through a link, but directly to a guest user, then it can work, but thats not the case in my situation.

     

    Regards,

    Ruben

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 423

#2
11manish Profile Picture

11manish 308 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 177

Last 30 days Overall leaderboard