web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / office365groups.listgr...
Power Apps
Unanswered

office365groups.listgroupmembers function how to select specific attributes?

(0) ShareShare
ReportReport
Posted on 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. 

Categories:
I have the same question (0)
  • joshburnsM4dev Profile Picture
    83 on at

    hi @rbn_nue,

     

    not sure how big your group is but you can something like this

    Office365Groups.ListGroupMembers(GroupID, {'$top':999}).value 

     

    this should return the top 999 members of the group. I am unsure of any threshold for the function but could be worth testing out by changing the number.

     

    To return the displayName and email, you can use a gallery and then edit the layout to title and subtitle and change the fields so that title is displayname and subtitle is mail.

     

    Cheers

     

    Josh

  • rbn_nue Profile Picture
    on at

    Hi @joshburnsM4dev ,

     

    Thank you for your response. Although, this is not what I was looking for. I'm already using the mentioned function to get user list. The concern is it returns the below properties per user:

     

     

    {
     "@odata.type": "#microsoft.graph.user",
     "id": "2213",
     "businessPhones": [
     "00000000"
     ],
     "displayName": "test",
     "givenName": "test",
     "jobTitle": "test",
     "mail": "test",
     "mobilePhone": "0000000",
     "officeLocation": "test",
     "preferredLanguage": null,
     "surname": "test",
     "userPrincipalName": "test"
     },

     

     

    The response size is huge and it takes 2 to 3 seconds to load all these data when the number of users is large.  Out of these properties, I only need displayName and email. I'm looking for any methods to just get those from the function call itself. 

  • joshburnsM4dev Profile Picture
    83 on at

    hi @rbn_nue 

    Is this the JSON result from the PowerAutomate flow to get office group members?

    After the list group members action, you can add the parse json action and use the value from the list group members as the Content and copy the json results into the generate from sample window.

    Now you will need an apply to each action and then use the body from the parse JSON action as the output from previous steps. Within the apply to each, you will need to use the compose action. Here is where you compose your array of displayName and mail.

    I have attached a screenshot for infopowerAutomateExample.png

    Cheers

     

    Josh

  • rbn_nue Profile Picture
    on at

    Hi @joshburnsM4dev ,

     

    I appreciate your inputs. But this is not what I'm looking for. I have already mentioned in my original post that I'm able to use power automate to call api and select specific properties (reduces response size). But overall it has same performance compared to the Office365.listgroupmembers (which returns all properties). 

     

    Thank you. 

  • joshburnsM4dev Profile Picture
    83 on at

    @rbn_nue how are you displaying all of the Office365.listgroupmembers properties in PowerApps?

  • rbn_nue Profile Picture
    on at

    Hi @joshburnsM4dev ,

     

    I use the below formula at the moment:

     

    ClearCollect(colName,Office365Groups.ListGroupMembers(<ID>,{'$top':999}).value)
  • joshburnsM4dev Profile Picture
    83 on at

    @rbn_nue ok but are you using a gallery or datatable etc to display your group members?

  • rbn_nue Profile Picture
    on at

    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. 

  • joshburnsM4dev Profile Picture
    83 on at

    @rbn_nue ok, to get the displayname and email you can add onto the end of the formula for example 

    Office365Groups.ListGroupMembers(<ID>,{'$top':999}).value.DisplayName 

  • Craig_Humphrey Profile Picture
    186 on at

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard