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 ?
onstart
----------
Set(
isAllowed,
User().Email in Office365Groups.ListGroupMembers("cfba5f58-8ff9-467c-b045-d4c350b3330c").value.userPrincipalName
)
The above code is always returned as Blank
OnVisible:
--------
I am using isAllowedVariable
But this is not solving the issue
Solved! Go to Solution.
Hi,
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
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.
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
User | Count |
---|---|
253 | |
106 | |
94 | |
50 | |
39 |