Skip to main content
Community site session details

Community site session details

Session Id : cZyiiFOd/aJjVaIkCNE2iI
Power Apps - Building Power Apps
Unanswered

office365groups.listgroupmembers function how to select specific attributes?

Like (0) ShareShare
ReportReport
Posted on 16 Aug 2022 13:40:22 by

Hi Folks,

 

I'm trying to use office365groups.listgroupmembers function in canvas app to get list of members in a group. This works as expected. Although, if the number of users in group is huge, the response size of the function is also large which in turn affects the performance. I only need user email and display name to be retrieved. Is there anyway to select only these from office365groups.listgroupmembers?

 

I tried using power automate flow to get office group members and use select there which reduced the response size, but the flow is understandably slower than the office365 groups function. so both methods are not providing the expected performance. Is there anyway to optimize this?

 

Thank you. 

  • victorcp Profile Picture
    2,347 Moderator on 07 Jun 2024 at 14:40:53
    Re: office365groups.listgroupmembers function how to select specific attributes?

    have you tried:

    ClearCollect(
     colName,
     ShowColumns(
     Office365Groups.ListGroupMembers(<ID>,{'$top':999}).value,
     mail,displayName
     )
    )
  • MarekKaminski Profile Picture
    23 on 11 Jan 2024 at 11:36:11
    Re: office365groups.listgroupmembers function how to select specific attributes?

    Thanks for that tip about the {'$top':999} property, @joshburnsM4dev ! If it weren't for you, probably hundreds of users would end up being omitted in my final solution

  • rbn_nue Profile Picture
    on 31 Mar 2023 at 03:45:18
    Re: office365groups.listgroupmembers function how to select specific attributes?

    Hi All,

     

    I had followed a different path to fix this issue. Missed to update it here. Here's what I did:

     

    - Used a power automate flow to get all group that user is a member of - In the flow I used send an http request to office 365 groups action and used the graph API endpoint - https://learn.microsoft.com/en-us/graph/api/user-list-transitivememberof?view=graph-rest-1.0&tabs=http

     

    - I then compare the groups I had with the users groups.

     

    The purpose of this comparison was to define the logged in users permission in the app. 

     

    Hope this helps.

     

    Thanks.

  • rickman Profile Picture
    2 on 30 Mar 2023 at 21:01:03
    Re: office365groups.listgroupmembers function how to select specific attributes?

    @rbn_nue wrote:

    No, I'm using this to check if current logged in user is part of this group and later to send emails to all group members. 


    @rbn_nue

    This above is a little more nuanced than your original post. To check if the current logged in user is part of a group, you could just use a simple boolean to check the user against the known group id, which you could save as a variable (or type in the string directly). You would use the ListOwnedGroupsV3 function to check against the groups the current user belongs to. Something like this would resolve to true if the user was not a member of the specified group. Like so:

     

     

     

     

    IsBlank(LookUp(Office365Groups.ListOwnedGroupsV3().value, vargroupid = id))

     

     

     

     

    What's the scenario for the emails to the specified group? There are multiple methods to achieve this directly in the app or in Power Automate.

  • MWAN Profile Picture
    66 on 30 Mar 2023 at 20:29:04
    Re: office365groups.listgroupmembers function how to select specific attributes?

    Make sense, I used it in a label control, which expects text value. 

  • Craig_Humphrey Profile Picture
    166 on 30 Mar 2023 at 19:54:31
    Re: office365groups.listgroupmembers function how to select specific attributes?

    OK, that sounds like it's whatever you're sending the results of ListGroupMembers() to, that is complaining.

    What control/field are you using to consume/present the output from ListGroupMembers()?

     

    .value is still going to be an array of objects, so you probably need something like:

     

    Concat(Office365Groups.ListGroupMembers("1dfb1xxxxxe-25fc-4xxx-8016-f92a064d1d34").value, Display Name & ", ")

     

  • MWAN Profile Picture
    66 on 30 Mar 2023 at 19:41:09
    Re: office365groups.listgroupmembers function how to select specific attributes?

    I selected .value afterOffice365Groups.ListGroupMembers("1dfb1xxxxxe-25fc-4xxx-8016-f92a064d1d34"), then it complained about it expected text, not table

  • Craig_Humphrey Profile Picture
    166 on 30 Mar 2023 at 19:32:47
    Re: office365groups.listgroupmembers function how to select specific attributes?

    Is Office365Groups.ListGroupMembers complaining that it expects text, or is the function that is outside of it complaining?

     

    Note: I'm pretty sure ListGroupMembers().value is going to return an array of objects, not simply text.

  • MWAN Profile Picture
    66 on 30 Mar 2023 at 18:08:47
    Re: office365groups.listgroupmembers function how to select specific attributes?

    Hi, when I try to use Office365Groups.ListGroupMembers("1dfb1xxxxxe-25fc-4xxx-8016-f92a064d1d34").value, i got an error that it expects a text. 

     

    .value doesn't work. 

  • Craig_Humphrey Profile Picture
    166 on 27 Jan 2023 at 03:45:08
    Re: office365groups.listgroupmembers function how to select specific attributes?

    I feel your pain, in both the problem you are having and in the responses you've been getting.

     

    While there is a (preview?) setting to reduce columns returned to just the ones you actually use, I don't know if the Office365Groups connector honors this.  Given that it doesn't honor the existing paging setting...

     

    What are you doing if there are more than 999 members in a group?

     

    You might be better off using the AzureAD connector: Azure AD - PowerApps Connector (carlosag.net) which can return the groups of a given user.  That would cover off your "is the user a member of group X" without getting swamped by the number of groups.

    I would then lean on Power Automate to enumerate a group's members and send the email.

     

    Good luck!

    Craig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete