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 / Restricting view of Bu...
Power Apps
Answered

Restricting view of Button based on groups.

(0) ShareShare
ReportReport
Posted on by 726

I am trying to restrict view of a button based on groups. 

 

I have 6 buttons, 4 of those i want only managers to be able to see 

 

I'm adding the below on the on viability of the button  (group ID i have taken from Azure AD object ID, I have added the Office365Groups connection.

 

VarUserEmail in Concat(Office365Groups.ListGroupMembers("GROUP ID").value, Mail)

 

 

That button does disappear for me as i am not a member of this group, There is no error on the screen but if i try with a group i am in it also does not show. 

 

I am wondering if there is only certain types of groups this works with, like distribution groups clearly i am missing a step here but i am not sure what, Any ideas? 

Categories:
  • amyharkus86 Profile Picture
    726 on at

    I have also tried 

    If(
     "amy.harkus@mycompany.com" in Office365Groups.ListGroupMembers("06941298-d116-4663-b5d7-d7de9f50c743").value.mail,
     true,
     false
    )

    this works, as i am in this group, But ideally i do not want to write every persons email address i would like it to look up the email address and see if they are in the group to then display the button.

     

    I thought the below would work but it doesn't seem to. 

     

    If(
     User().Email in Office365Groups.ListGroupMembers("06941298-d116-4663-b5d7-d7de9f50c743").value.mail,
     true,
     false
    )

     

  • Verified answer
    amyharkus86 Profile Picture
    726 on at

    Worked out is was due to the email address in the group being different from the on in Azure AD, In our groups we use the full email addresss firstname.surname@xxxx.com but the email address in azure is looking for firstinitialsurname@xxxx.com

     

    So i created a label box called UserName and put a default as user()displayName i then changed the code a little 

     

    If(
     CurrentUser.Text in Office365Groups.ListGroupMembers("06941298-d116-4663-b5d7-d7de9f50c743").value.displayName,
     true,
     false
    )

     

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    @amyharkus86 

     

    It seems you have figure out the issue by yourself.

    Could you mark your post as an answer to help more member to find it quickly?

    Sik

  • chairat Profile Picture
    64 on at

    Thank you so much 

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard