Removing Duplicates from an Array in PowerAutomate
A while back, I was using PowerAutomate to automate the creation of individual, personalised Calendar Invites to users based on a set of email addresses.
The problem was that the email address list provided contained lots of duplicate email addresses, which meant some recipients received duplicate Calendar Invites.
Ugh. So how do we fix this?
The answer is using the union function in PowerAutomate!
We can use union to 'union' the original array of email addresses with itself; this results in the creation of a new array of unique email addresses - which is what we want!
A screenshot of the Flow Segment used is shown here:
.... and the contents of the Union expression shown in the first box is:
union(variables('Attendee Emails'),variables('Attendee Emails'))