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 / AD Permissions using H...
Power Apps
Unanswered

AD Permissions using Horizontal Gallery Buttons

(0) ShareShare
ReportReport
Posted on by

Hi All,


My first post in the Power Apps forums.

I've come across an issue I'm having with using the horizontal gallery and buttons.

I have a set of 3 buttons (Button 1, Button 2, Button 3) in the horizontal gallery

 

I've managed to get to the point where I can show certain cards depending on the button clicked which is great!

Now I want to go even further and permission each button according to the AD group the user belongs to

 

For example, button 1 is always going to be visible. The form begins on button 1.

Button 2 is for a particular AD group and Button 3 would be for another.

 

How can I do this using the horizontal gallery?

This is what I currently have

 

my OnStart is

 

 

Set(
 varTabSelected,
 1
);
Set(
 varUser,
 User()
);
Set(
 isUserMemberM365Group,
 !IsBlank(varUser.Email in Office365Groups.ListGroupMembers("adgroupObjectID").value.mail)
);

 

 

 

My gallery Items property is

 

 

 

Table(
 {ID:1, Label:"Button 1"},
 {ID:2, Label:"Button 2", Visible: isUserMemberM365Group },
 {ID:3, Label:"Button 3"}
)

 

 

 

I tested a blank button and changed its visible property to 

isUserMemberM365Group and it worked properly. I just dont know how to apply this same thing to a horizontal gallery above. 
 
Thanks for all the help!

 

Categories:
  • enriqueglopez Profile Picture
    518 Moderator on at

    Try to add that condition to every visible property of every button you want to show/hide.

     

    For example,

     

    Button2, only users in group "35ef6ba2-39d4-47bb-9d06-90ccc0572ff3" should see this one:

     

    Visible property:
    
    !IsBlank(varUser.Email in Office365Groups.ListGroupMembers("35ef6ba2-39d4-47bb-9d06-90ccc0572ff3").value.mail)

     

    If the user does not belong to that office group, IsBlank() will return true, with the ! you had, this true will be false and therefore, the visible property of that button will be false (not visible).

     

    For security reasons I recommend to store this information previously, when the app is loading (OnStart).

     

    You could do:

     

    App.OnStart

    Set(UserInGroup2,
    !IsBlank(varUser.Email in Office365Groups.ListGroupMembers("35ef6ba2-39d4-47bb-9d06-90ccc0572ff3").value.mail)
    );
    
    Set(UserInGroup3,
    !IsBlank(varUser.Email in Office365Groups.ListGroupMembers("another group GUID").value.mail)
    );

     

    And then, in the buttons:

    Button2.Visible
    UserInGroup2
    
    Button3.Visible
    UserInGroup3

     

    You were pretty close to the answer. Hope this helps.


    If it did please accept as solution and give it a 👍 so we can help others in the community.

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard