cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Check if current user is a manager of anyone in AD

I would like to run a check to see if the person currently logged in is a manager of anyone in the entire company.  If so, I will make a button visible and bring user to a different screen where i would like to run a query and provide a browse gallery of items in a list of users of whom he/she is a manager of.

 

This shouldn't be too hard. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: Check if current user is a manager of anyone in AD

You can use the Office 365 Users connector, which has an operation where you can get the list of direct reports of a user (people that report directly to her/him), and make the decision based on that list. For example, if you have this expression in the OnVisible property of your screen (or OnStart property of your app):

ClearCollect(
    myReports,
    Office365Users.DirectReports(
        Office365Users.MyProfile().Id))

Then you can set the Visible property of the button to

CountRows(myReports) > 0

And the button will show up if the logged in user is a manager of anyone.

View solution in original post

2 REPLIES 2
Highlighted
Power Apps
Power Apps

Re: Check if current user is a manager of anyone in AD

You can use the Office 365 Users connector, which has an operation where you can get the list of direct reports of a user (people that report directly to her/him), and make the decision based on that list. For example, if you have this expression in the OnVisible property of your screen (or OnStart property of your app):

ClearCollect(
    myReports,
    Office365Users.DirectReports(
        Office365Users.MyProfile().Id))

Then you can set the Visible property of the button to

CountRows(myReports) > 0

And the button will show up if the logged in user is a manager of anyone.

View solution in original post

Highlighted
Helper I
Helper I

Re: Check if current user is a manager of anyone in AD

That worked perfectly! Thank you!  Now I need to find out how to get create a browsegallery that contains object from a list that were created by users that are managed by the person. Cat Surprised

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,101)