Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Show/Hide based in Allowed list in canvas app


Hi team,

I have an Active Directory group.
I have to show a tab only if the logged in user is part of the AD group.
Otherwise the tab should be hidden,
What is the piece of code to be written ?

User().Email in Office365Groups.ListGroupMembers("cfba5f58-8ff9-467c-b045-d4c350b3330c").value.userPrincipalName
The above code  is always returned as Blank



I am using isAllowedVariable



But this is not solving the issue


Accepted Solutions

Adding a Not() in front helped

View solution in original post

Super User
Super User



This is a bit confusing. When you say a tab, do you mean a screen? Otherwise, where does OnVisible fit in? Do you mean the Visible property of a control?


And you Set isAllowed but are using isAllowedVariable?


If you add a gallery, set its atems to Office365Groups.ListGroupMembers("Your GUID").value and add a couple of labels in it with ThisItem.displayName and ThisItem.userPrincipalName can you see what you would expect?


Other stuff you can try:
CountRows ( Filter ( Office365Groups.ListGroupMembers("Your GUID").value, userPrincipalName = User().Email ) )

It should return 1 if the user is part of the group






Regards. JD.
Super User
Super User

I forgot about this one, but putting this in a label to have a visual of the result may also be helpfull:


User().Email in Office365Groups.ListGroupMembers("Your GUID").value.userPrincipalName


If it returns true then the user is in the group.




Regards. JD.
Helper I
Helper I

Thank You @jcfDaniel 

I was able to achieve using ClearCollect(newfromSG,Office365Groups.ListGroupMembers("cfba5f58-8ff9-467c-b045-d4c350b3330c").value) on OnStart


If(User().Email in newfromSG.userPrincipalName,"Do A","Do B")  in Visible


 I would like to check if User().Email not in  newfromSG.userPrincipalName   - What is the correct syntax for that ?

Adding a Not() in front helped

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,658)