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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Fetch members from nes...
Power Apps
Unanswered

Fetch members from nested Security Groups in PowerApps

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

We have a requirement to restrict user access to certain pages within PowerApps.

The users are part of various security groups which again are part of a single SG.

Thus, there are multiple layers of Security Groups we need to access to get the user data.

 
 
 
 
 

Currently, we are accessing the SGs using nested ForAll loops in the OnStart property as below.

 

Kulshreshtha_0-1608218460829.png

This is an intensive operation and hence the app takes approx. 2 min to load.

Is there a way to enhance the performance of the app?

 

Thanks in advance

    

Categories:
  • FabianAckeret Profile Picture
    975 on at

    Hi @Kulshreshtha 

    I assume your data source is SharePoint? Unfortunately, Power Apps isn't very great when it comes to security settings with SharePoint. If you have individual permission requirements, this can get difficult. 

    If possible it would probably best to use Dataverse as a data source. You have much better security options/control.

     

    If above is not an option, you could try to change your formula. Do you really need to loop through all of them? Can't you simply check if the user is part of a specific group? Like so:

    !IsEmpty(
     Filter(
     Office365Groups.ListGroupMembers(
     "<group Id>"
     ).value,
     mail = User().Email
     )
    ) || !IsEmpty(
     Filter(
     Office365Groups.ListOwnedGroupsV2().value,
     id = "<group Id>"
     )
    )

     

    Also, if you indeed need to loop through them, I realized you're using the same command a few times.

    I would recommmend you to look into the With() function. Perhaps this could speed things up a bit.

     

    Sorry for not being a better help...

     

  • FabianAckeret Profile Picture
    975 on at

    Hi @Kulshreshtha 

     

    Did my answer help you out? If so, it would be great if you could accept it as a solution.

     

    Thanks and kind regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard