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

Listing users with particular role

Hi, I have a scenario where I want to list User with a particular security role. Let's say we have the user with Roles Account Manager, Activity Feed, CEO etc. I want the Users with Role Account Manger only in PowerApps. Can you show us how can it be achieved?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Listing users with particular role

Hi @summitb

 

This is not a great solution for larger environments, but for smaller environments you could write the Office365 users into a collection, and then filter the collection according to JobTitle.

Write address book into collection:

ClearCollect(colAddressBook,Office365Users.SearchUser({searchTerm:"",top:500}))

(*If you don't specify the Top parameter, the query only returns 100 results, which depending on your environment, might not be enough for all users)

 

Filter accordingly:

Filter(colAddressBook,JobTitle="Chief Executive Officer")

Let me know if you don't come right.

 

twitter: @dawidvh

youTube: https://www.youtube.com/channel/UCIMe_ErQZP5chbI9UyW0xLw

>>If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions.<<

 

 

View solution in original post

5 REPLIES 5
Highlighted
Super User II
Super User II

Re: Listing users with particular role

Hi @summitb

 

Are you trying to only give users with a specific role access to open the PowerApp, or are you trying to verify that a user has a specific role before allowing him\her to perform a certain action?

 

The first might not be easy to do, but the second can be done by using the Office 365 Users connector and the following formula which will return true or false.

Office365Users.MyProfileV2().jobTitle = "Top Dog"

 

Highlighted
Resolver I
Resolver I

Re: Listing users with particular role

Hey @DavesTechTips,
I wanted to list users that have certain roles. For example I want to show list of System Adminstrators in the Gallery List in PowerApps. Is there any way out for this?

Highlighted
Super User II
Super User II

Re: Listing users with particular role

Hi Summit,

 

a) So you would like to get this list from the O365 tenant?

b) How many users do you in the organisation?

 

 

Highlighted
Resolver I
Resolver I

Re: Listing users with particular role

We have around 10-15. For a specific role, let's say System Administrator, we have around 3 people. Can we list them out?

Highlighted
Super User II
Super User II

Re: Listing users with particular role

Hi @summitb

 

This is not a great solution for larger environments, but for smaller environments you could write the Office365 users into a collection, and then filter the collection according to JobTitle.

Write address book into collection:

ClearCollect(colAddressBook,Office365Users.SearchUser({searchTerm:"",top:500}))

(*If you don't specify the Top parameter, the query only returns 100 results, which depending on your environment, might not be enough for all users)

 

Filter accordingly:

Filter(colAddressBook,JobTitle="Chief Executive Officer")

Let me know if you don't come right.

 

twitter: @dawidvh

youTube: https://www.youtube.com/channel/UCIMe_ErQZP5chbI9UyW0xLw

>>If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions.<<

 

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,916)