If you have played around with Office 365, you have noticed that permissions are centralized with Groups (Teams, SharePoint…). You can manage at different level, but here I am going to show you how to play with it through PowerApps.
Please note that this article has been written the 19th of August 2020. This connector might have change by now.
- Add Office 365 Groups Connector to PowerApps application
- Difference between ListOwnedGroupsV2 and ListOwnedGroupsV3
- ListOwnedGroupsV2 method
- ListOwnedGroupsV3 method
- ListGroupMembers method
- AddMemberToGroup method
- RemoveMemberFromGroup method
1. Add Office 365 Groups Connector to PowerApps application
Let’s start with the connector in PowerApps. In the connectors panel, such as connecting SharePoint data, you will find the Office 365 Groups connector. Click on it then on add a connection.
2. Difference between ListOwnedGroupsV2 and ListOwnedGroupsV3
Before to go deep into the two method, please note there is a different between ListOwnedGroupsV2 and ListOwnedGroupsV3. ListOwnedGroupsV3 isn’t just an update of ListOwnedGroupsV2.
- ListOwnedGroupV2 is going to list all the groups you own.
- ListOwnedGroupV3 is going to list all the groups you own but also the ones you are members too.
Example: On a screen I have made a Count Row of the value returned by the two methods. You can see that ListOwnedGroupV3 have more results than ListOwnedGroupV2.
3. ListOwnedGroupsV2 method
So just as mentioned below, this method is going to list the groups you own.
Just note that behind the connector, you are using the Graph API, so such as the Microsoft Teams connector, if you are calling the method this way:
Office365Groups.ListOwnedGroupsV2()
It will return an object as following:
{ '@odata.context' : "https://graph.microsoft.com/v1.0/$metadata#groups", value : [ARRAY OF OBJECTS WITH THE RESULT] }
So if you want to get the groups and in a gallery for example, you need to get the value.
Office365Groups.ListOwnedGroupsV2().value
So the value is an array of objects representing your groups data. The objects values are as following:
Key name | Type | Description |
---|---|---|
displayName | String | The display name of the group. |
id | Guid as String | GUID of the group. |
Guid as String | e-mail adress of the group. | |
createdDateTime | DateTime | Date of the creation of the group. |
visibility | String | Value are Public or Private. |
description | String | Description of the group. |
4. ListOwnedGroupsV3 method
So just as mentioned below, this method is going to list the groups you own such as the groups which you are members.
Just note that behind the connector, you are using the Graph API, so such as the Microsoft Teams connector, if you are calling the method this way:
Office365Groups.ListOwnedGroupsV3()
It will return an object as following:
{ '@odata.context' : "https://graph.microsoft.com/v1.0/$metadata#groups", value : [ARRAY OF OBJECTS WITH THE RESULT] }
So if you want to get the groups and in a gallery for example, you need to get the value.
Office365Groups.ListOwnedGroupsV3().value
So the value is an array of objects representing your groups data. The objects values are as following:
Key name | Type | Description |
---|---|---|
displayName | String | The display name of the group. |
id | Guid as String | GUID of the group. |
Guid as String | e-mail adress of the group. | |
createdDateTime | DateTime | Date of the creation of the group. |
visibility | String | Value are Public or Private. |
description | String | Description of the group. |
5. ListGroupMembers method
This method gives you all the members and owners of a group.
It takes as input the Group GUID, you can find it with the ListOwnedGroup methods above.
Such as the ListOwnedGroup methods, it is using the Graph API, so such as the Microsoft Teams connector, if you are calling the method this way:
Office365Groups.ListGroupMembers("[GUID OF THE GROUP]")
It will return an object as following:
{ '@odata.context' : "https://graph.microsoft.com/v1.0/$metadata#groups", value : [ARRAY OF OBJECTS WITH THE RESULT] }
So if you want to get the group members and in a gallery for example, you need to get the value.
Office365Groups.ListGroupMembers("[GUID OF THE GROUP]").value
So the value is an array of objects representing your members data. Here is an example of the value you can find, the most useful ones to me:
Key name | Type | Description |
---|---|---|
displayName | String | The member display name. |
String | The member email adress. | |
id | GUID as String | The member id into the group. |
userPrincipalName | GUID as String | The member user principal name. |
6. AddMemberToGroup method
This method is giving members access to someone into a group. So this person will appears as members into a Teams or a SharePoint for example.
This method have two input:
Key name | Type | Description |
---|---|---|
ID of the group | GUID as String | The group GUID, you can get it from ListOwnedGroup above. |
User principal name | String | The user principal name. You can get it from ListGroupMembers method. |
Office365Groups.AddMemberToGroup("[GROUP GUID]";"[USER PRINCIPAL NAME]")
7. RemoveMemberFromGroup method
This method is removeing someone from a group. So, for example, this person will no longer have access to the Teams, or SharePoint related to the group.
This method have two input:
Key name | Type | Description |
---|---|---|
ID of the group | GUID as String | The group GUID, you can get it from ListOwnedGroup above. |
User principal name | String | The user principal name. You can get it from ListGroupMembers method. |
Office365Groups.RemoveMemberFromGroup("[GROUP GUID]";"[USER PRINCIPAL NAME]")