cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Getting SP user ID from O365 user profile ID/Email for new user

Hello,

 

I am trying to build a flow for end users with a manual trigger where you can enter an email of a new colleague, choose a unit and then there two folders are created for the person within the given unit's folder within a Document library.

 

Now, I have used HTTP requests to break inheritance on the folders, to get the principal ID of the SP site group, and to assign roles for these site groups to the folders. This part works as expected.

 

There is one thing I cannot figure out - when I want to add access to the new employee for one of the folders via a HTTP request as well, I run into some issues. I use the 'Get Profile O365' action to get user's data from the email entered, but the O365 ID does not correspond with the SP user ID. I have checked some topics which suggest the following request to be used to get the proper ID:

 

_api/web/SiteUsers/getByEmail('name@company.com')

 

Nevertheless, they note that if the user has not visited the site, or any SP site before, the flow may not work and permissions will not be set up accordingly. In case of a new user, that's a likely scenario. What would be a workaround or a fail-safe method to get the proper user ID in this case?

 

thanks

2 REPLIES 2
Highlighted

Re: Getting SP user ID from O365 user profile ID/Email for new user

Highlighted
Regular Visitor

Re: Getting SP user ID from O365 user profile ID/Email for new user

@PieterVeenstra thanks - there are some details regarding case why this isn't a best solution, however, I realized I was waaay over-complicating things and kind of forgot about the simple, out-of-the-box 'Grant access to a folder' action which just does what it says without the need of HTTP requests 🙂

 

Anyway, thanks for replying

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,346)