1. The world leader in serving science
Permissions in
Power Apps based
on Office 365 Groups
02JUL2020
Peter Heffner
@Lingualizer
2. Power Apps & Office 365 Groups
What is covered?
List owned groups
List group members
Check membership
This is a concept how to use Office 365 groups to
show/hide content like buttons or navigation
menus in Power Apps.
It makes it easier for non-developers to manage
permissions for Power App content.
Permissions of the logged in user in the app are
defined by the membershipin an Office 365 Group.
Connected Data Sources
Office365Groups
Office365Users
3. Remarks
This presentation describes how to get information
about Office 365 Groups and list the members of a
group.
If this scenario is used in a productive application
the developer would get the ID of the group and
check directly the membership OnStart or on the
Home screen.
4. List my Groups
Items = SortByColumns(
Office365Groups.ListOwnedGroupsV3().value,"displayName",Ascending)
// To keep some data in variables and collections for later use
OnSelect = Set(glb_selO365Group,ThisItem.id);
// The email address of the selected O365 group
Set(glb_selO365GroupMail,ThisItem.mail);
// Storing all members and details in a Collection
ClearCollect(collMembers, Office365Groups.ListGroupMembers(g_MyGroups_1.Selected.id)
.value);
// Concatenate all email addresses, so I can email the members directly
Set(glb_MailIndividuals,Concat(collMembers,";" & mail))
5. List Group Members
Add a List box and display the Members:
Items = Office365Groups.ListGroupMembers(glb_selO365Grou
p).value
Add a text field and display the concatenated emails
Text = glb_MailIndividuals
// Both variables glb_selO365Group and
glb_MailIndividuals have been set in the previous slide
6. Check Membership
Add a Combobox to select a user
OnChange = Set(glb_selUser, cbx_SearchUser.Selected.Mail)
Add a text label to display the email address (optional)
Text = glb_selUser
Add an image control
If(
IsBlank(
Find(glb_selUser, glb_MailIndividuals)),
'Thumbs-Down',
'Thumbs-Up'
)
7. Summary
Create Office 365 Groups for each permissionyou want to use in a Power App
Add your users to the desired groups
In Power Apps check to which group the currently logged in user belongs to
Use this information to hide/display controls like buttons or navigation menus
Resources: https://docs.microsoft.com/en-us/connectors/office365groups