In this post, I am going to show you how I can identify new or recently removed members in a 365 Group.
Why did I need this?
After managing a learning community Team for the last several months I found myself asking the recently departed members why they left. Typically, I would chat message them in hopes they can give me constructive criticism and feedback for improvement; a manual process.
Automate the identification of recently removed members within my 365 Group so I can then follow-up with them programmatically.
Power Automate Connectors
In this example, I will be using:
- Office 365 Groups – https://docs.microsoft.com/en-us/connectors/office365groups/
- Office 365 Users – https://docs.microsoft.com/en-us/connectors/office365users/
- Microsoft Teams – https://docs.microsoft.com/en-us/connectors/teams/
Office 365 Groups
When creating an Automated flow, you need an event trigger. Learn how to Create a flow in Power Automate @ https://docs.microsoft.com/en-us/power-automate/get-started-logic-flow. This connector has the trigger event When a group member is added or removed which is exactly what we are looking for.
The values that are returned from this trigger are:
- I will use this in Office 365 Users > Get User Profile (V2)
- I will use this in the conditional boolean logic action
I used the Get a team action simply to be able to retrieve ‘Display Name’ of the Team which the event is occurring on. This allows me not to hard-code this value later.
Office 365 Users
I find myself using this connector often. What I have found is that helpful values like ‘Display Name’ and ‘Mail’ are pretty much essential to making dynamic personalized flows like this.
Learn how to Add multiple actions and advanced options to a flow @ https://docs.microsoft.com/en-us/power-automate/multi-step-logic-flow.
For our needs, we can describe these actions as:
- Get my Profile (V2) – The Power Automate Owner
- Get user Profile (V2) – The Group Member who triggered the event
Using a boolean on the return value from the trigger (Reason) I can have two different outcomes; a member was added or a member was removed.
The empty() Expression
I was not able to find the documentation on returned values for ‘reason’. I took a gamble and assumed that if there was not a reason (it was empty) then that must mean they have been added to the Team.
The true Expression
Make sure to use the Expression editor rather than the text string ‘true’.
Output from the Conditional Logic
As you can see, I am sending a message as the flowbot to a user within Teams. As this is an example, it is easiest to test by sending myself a message using the dynamic content from ‘Get my profile (V2)’.
It is at this point that you get to decide what happens. Do you want to introduce yourself to the new member via email? Do you want to send a hyperlink to an MS Form with questions about why someone left?
For our example, I send a dynamically generated message to myself in Teams.