cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
iw
Frequent Visitor

ckeck if special user has access to a document in SPO

hi to all,
i have a flow triggered from a powerapp and a user email address comes from the app.

In the flow i try to check if the user (from email address) has access to a special document in a document library.

If not the flow should not give back the content of the document.

 

How can i do the access check?

 

regards

 

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @iw 

 

Use the REST API method HTTP Get method getusereffectivepermissions(@user)?@user='<user login name>' to determine user permissions.

 

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn5314...

 

Look section GetUserEffectivePermissions method

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

3 REPLIES 3
abm
Super User
Super User

Hi @iw 

 

Use the REST API method HTTP Get method getusereffectivepermissions(@user)?@user='<user login name>' to determine user permissions.

 

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn5314...

 

Look section GetUserEffectivePermissions method

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
RezaDorrani
Dual Super User II
Dual Super User II

Hi @iw 

 

Since your PowerApp is calling Flow it will do so in the context of the current logged in user

 

If you try and query that special document library item for the current user it will either return no results or exception

 

For no results you can check the length of the result set, if 0 then user does not have access

If exception for file not found =, you can configure run after step and return empty content

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

iw
Frequent Visitor

thank you for your Feedback.

 

is this the right way?

 

_api/web/GetFileByServerRelativeUrl('/Folder Name/file name')/$value/getusereffectivepermissions(@user)?@user='loggedInUser'

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,320)