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

Search Group List returned from Office 365 Group Connector

I am trying to utilize the Office 365 Groups Connector in my powerapps. Basically I want to be able to pull the list of users in a group, check if the current users email is in that group, if so display "A Button", if not display "B Button". A little more complicated than that, but I am struggling to just view the values returned from the list.

 

I have set up the connector to my PowerApp and am trying to get a list of all the members of a group using Office365Groups.ListGroupMembers('groupId'). I can't figure out if this is working because it returns an Array of users and I don't know how to get that list to even appear on a blank powerapps page just to see the values. I can't set it to a labels text property because it is expecting a string and there doesn't appear to be a way to return like the first value in an array like groupList[0]. Any idea how I could display this array onto a powerapps page just to see the values being returned?

 

If so, any thoughts on how to search this array for an email?

1 ACCEPTED SOLUTION

Accepted Solutions
tchin-nin
Resident Rockstar
Resident Rockstar

Hi @asAdmin

 

To visualize this array you can ClearCollect it and look the content of your collection by clicking on 'File' > 'Collection'

You can add a button and set the OnSelect property to :

Clearcollect(MyGroupUsers,Office365Groups.ListGroupMembers('groupId'))

Or you can use a Gallery to display the users on a screen :

'Insert'>'Gallery', and set the Items property of the gallery to

Office365Groups.ListGroupMembers('groupId')

The Labels within the gallery must be set according to your array's properties

For example, Label.Text : ThisItem.DisplayName

 

Theo

View solution in original post

5 REPLIES 5
tchin-nin
Resident Rockstar
Resident Rockstar

Hi @asAdmin

 

To visualize this array you can ClearCollect it and look the content of your collection by clicking on 'File' > 'Collection'

You can add a button and set the OnSelect property to :

Clearcollect(MyGroupUsers,Office365Groups.ListGroupMembers('groupId'))

Or you can use a Gallery to display the users on a screen :

'Insert'>'Gallery', and set the Items property of the gallery to

Office365Groups.ListGroupMembers('groupId')

The Labels within the gallery must be set according to your array's properties

For example, Label.Text : ThisItem.DisplayName

 

Theo

That worked thank you!

I've been trying this same thing but can't seem to get it to work.

 

I'm trying to get the users returned from a 365 Group:

 

Office365Groups.ListGroupMembers('groupID').value.mail


Then make a button visible if the Office365Users.MyProfile().Mail is within that array.

 

I can't even get the ListGroupMembers to return an array into a lable text. The error is saying "The function 'ListGroupMembers' has some invalid arguments."

 

I pulled the Group ID from a MS Flow run that I ran that returned the data I'm looking for.

SumanthDundi7
Helper V
Helper V

@asAdmin , I need to implement the same.. Can you please help me with the steps on how achieved this? 

Anonymous
Not applicable

If you still need this, something like this should work:

 

If(LookUp(Office365Groups.ListGroupMembers("[groupid]").value, mail = Office365Users.MyProfileV2().mail,mail) = "false", false, true)
the lookup will return either an email address, or false, unfortunately you can just put the lookup in the visible property, so you need to use an if statement.
 
This has worked for me!
 
Rob

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,374)