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.
have you tried:
ClearCollect(
colName,
ShowColumns(
Office365Groups.ListGroupMembers(<ID>,{'$top':999}).value,
mail,displayName
)
)
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
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.
@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.
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.
Make sense, I used it in a label control, which expects text value.
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 & ", ")
I selected .value afterOffice365Groups.ListGroupMembers("1dfb1xxxxxe-25fc-4xxx-8016-f92a064d1d34"), then it complained about it expected text, not table
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.
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.
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
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2