My Idea Factory - By Ludovic Perrichon

Office365, Powerapps, Groups

Office 365 Groups Connector in PowerApps


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.

  1. Add Office 365 Groups Connector to PowerApps application
  2. Difference between ListOwnedGroupsV2 and ListOwnedGroupsV3
  3. ListOwnedGroupsV2 method
  4. ListOwnedGroupsV3 method
  5. ListGroupMembers method
  6. AddMemberToGroup method
  7. 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 nameTypeDescription
displayNameStringThe display name of the group.
idGuid as StringGUID of the group.
mailGuid as Stringe-mail adress of the group.
createdDateTimeDateTimeDate of the creation of the group.
visibilityStringValue are Public or Private.
descriptionStringDescription 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 nameTypeDescription
displayNameStringThe display name of the group.
idGuid as StringGUID of the group.
mailGuid as Stringe-mail adress of the group.
createdDateTimeDateTimeDate of the creation of the group.
visibilityStringValue are Public or Private.
descriptionStringDescription 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 nameTypeDescription
displayNameStringThe member display name.
mailStringThe member email adress.
idGUID as StringThe member id into the group.
userPrincipalNameGUID as StringThe 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 nameTypeDescription
ID of the groupGUID as StringThe group GUID, you can get it from ListOwnedGroup above.
User principal nameStringThe 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 nameTypeDescription
ID of the groupGUID as StringThe group GUID, you can get it from ListOwnedGroup above.
User principal nameStringThe user principal name. You can get it from ListGroupMembers method.
Office365Groups.RemoveMemberFromGroup("[GROUP GUID]";"[USER PRINCIPAL NAME]")