Hi all,
I have built a recurring flow which gets items from a SharePoint list and passes a person column through the Search for Users V2 function to obtain their UPN. I then add these UPNs to the group using the Add Member To Group function and it works great.
However, once users have been added to the group, the next time the flow runs it will fail for all of the entries where the UPN already appears in the group. This is expected behaviour, and it still adds someone who isn't a member of the group but appears in the SP List.
I was just wondering: what is the best/easiest way of filtering out users who are already a member of the group so that the flow doesn't fail every time it runs? I think I need some kind of lookup which looks up to see if the UPN which is found in the SP List already appears in the group. If yes then it skips that user, if no then it adds that user, and it does that for the whole list.
This is what my flow currently looks like:

When the flow fails this is where it fails:

And the error I get is this:
"statusCode":400,"headers":{"Transfer-Encoding":"chunked","Vary":"Accept-Encoding","Strict-Transport-Security":"max-age=31536000","request-id":"53839ad3-8a5c-4234-9f44-e74fa003e1f2","client-request-id":"53839ad3-8a5c-4234-9f44-e74fa003e1f2","x-ms-ags-diagnostic":"{\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"003\",\"RoleInstance\":\"AM1PEPF0000EEC6\"}}","x-ms-resource-unit":"1","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"no-cache","Date":"Mon, 17 Jan 2022 12:50:02 GMT","Content-Type":"application/json","Content-Length":"371"},"body":{"error":{"code":"Request_BadRequest","message":"One or more added object references already exist for the following modified properties: 'members'.","innerError":{"date":"2022-01-17T12:50:03","request-id":"53839ad3-8a5c-4234-9f44-e74fa003e1f2","client-request-id":"53839ad3-8a5c-4234-9f44-e74fa003e1f2"}}}}
Any help would be much appreciated,
Thanks,
Freddie