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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trying to Implement It...
Power Automate
Unanswered

Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing

(0) ShareShare
ReportReport
Posted on by 33

I have a SP site in which 'everyone except external' is assigned to the members group, which has edit access. Every time a new item is added to a list on this site, I want to reset the items inheritance, break the inheritance and then get the user's principal ID by doing a SP HTTP GET request function with the below uri (example uri) and then eventually grant them contribute access to the item. I have tried hardcoding the user's email, but normally, I am pulling it from a single line of text field on the backend list that stores the user's email. 

BriH_0-1709932963146.png

 

 

_api/web/SiteUsers/getByEmail('Bill.Test@domain.com')

 

 

 Problem is at this SP HTTP GET action, it just continually retries and eventually throws a bad gateway error. This does not occur with any user who is assigned specifically to the site such as the site owner for example, it instantly finds the user, but for anyone within the company under the 'everyone except external' group, it retries and retries until it eventually times out. 

 

What do I need to do to get this action to work properly

Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at
    Re: Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing

    @BriH This YT Tutorial might be helpful: Grant ITEM LEVEL Permissions on a SharePoint List ITEM with Power Automate

     

    In this video tutorial I’ll show you how to create an automation that will grant item level permissions to an Onboarding SharePoint task list item based on a Person column. This automation will go through the entire list and adjust the permissions for each item so the user selected in the Person column will have the ability to only view the status of their own tasks.

     

    IN THIS VIDEO:

    How to Grant Item Level Permissions in a SharePoint List with Power Automate

    How to Grant Read Access to Individual SharePoint List Items

    How to use the Manually Tigger a Flow Action

    How to use the Top Count to Reduce the Number of Items Returned

    How to use the Grant Access to an Item or Folder Action

    How to use the Concurrency Control for the Apply to Each Action

    How to Grant Item Level Permissions when a New Item is Created

     

    ----

     

    You might also find this tutorial helpful: How to Send a SINGLE EMAIL ✉️ with multiple SharePoint list items | Build THIS Power Automate Flow

     

    IN THIS VIDEO:

     How to send multiple list items in a single email with a Power Automate Flow

     How to create a dynamic date range

     How to use the Convert Time Zone action

     How to use a Filter Query in the Get Items action

    How to count number of items in an array

     How to use the Select action to extract a users display name and email address

     How to create a unique list of email addresses

     How to use the Create HTML Table action

     How to customize the HTML Table with CSS styles

    How to use the Send an email (V2) action

    How to use the Append to String Variable action

    How to create a custom list of items for an email

    How to use the Send an email (V2) action

    How to display singular or plural text based on the number of items returned

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok
     

  • BriH Profile Picture
    33 on at
    Re: Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing

    This does not drop the members group from the item, which is what I need. I need the members SharePoint group dropped from the list item and then reassign permissions based on a couple of single line of text fields I have that include user's email values. 

     

    Also, I still don't understand why I can't get the user's information using the HTTP GET action uri :

     

    _api/web/SiteUsers/getByEmail('test.user@brighthorizons.com')

     

    It just keeps retrying and eventually times out with a 502 bad gateway error and I don't understand why. Everyone except external is apart of the members group, so shouldn't this action have no issue? 

  • BriH Profile Picture
    33 on at
    Re: Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing
    This does not drop the members group from the item, which is what I need. I need the members SharePoint group dropped from the list item and then reassign permissions based on a couple of single line of text fields I have that include user's email values. 
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at
    Re: Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing

    @BriH If you need to drop the members, you will need to add the Stop sharing an item or file action before you grant access. 

    creativeopinion_0-1710188772896.png

    To get users info, you can use the Get Users Profile (V2) action. Insert an email address into the User (UPN) field.

    creativeopinion_1-1710188850412.png

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok
     
  • BriH Profile Picture
    33 on at
    Re: Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing

    I'm still getting the same issue - it just retries until it eventually throws a bad gateway error.

     

    I'm using the 'mail' dynamic value from the get user profile action above which does succeed. 

    Current uri:

     

    _api/web/SiteUsers/getByEmail('test.user@brighthorizons.com')

     

     

    BriH_0-1710189319701.png

     

    I tried switching up my uri to this 

    _api/web/SiteUsers(@v)?@v='test.user@brighthorizons.com'

    And this time it threw a 404 user not found error. Is something setup incorrectly on my site permissions, which is why this action cannot find the user? I have 'everyone except external' added to the default members and visitors group. 

     

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at
    Re: Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing

    @BriH 

    Instead of the Send an HTTP request, have you tried using the Grant Access to Item or Folder action? Instead of selecting one of the roles listed in the drop down, select Enter Custom Value.

    creativeopinion_1-1710198482780.png

     

    Full Control:1073741829 
    Design:1073741828
    Edit:1073741830
    Contribute:1073741827
    Read:1073741826

    Enter the word role (all lower case) and a colon and insert one of the role ids from above. In your case it would be 1073741827 for Contribute.

    creativeopinion_2-1710198542860.png 

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

     

     

  • BriH Profile Picture
    33 on at
    Re: Trying to Implement Item Level Permissions for a list - Getting User Principal ID Failing

    So, this works and does solve my issue, so thank you for that; however, I'm still curious as to why the HTTP request throws a bad gateway error? IF anyone has any insight into this, please let me know. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard