cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Snow
Frequent Visitor

Error adding O365 user group

I get the follow duplicate error when adding a user group to my app even though the user group is not listed as a user!

{"devError":"Cannot create team for undefined.","statusCode":400,"contentId":1,"body":"{\"error\":{\"code\":\"0x8004022a\",\"message\":\"Duplicate record exists. Cannot insert duplicate key row in object 'dbo.TeamBase' with unique index 'ndx_TeamName_BusinessUnitId'. The duplicate key value is <redacted>.\"}}"}

6 REPLIES 6
aboehm
Advocate I
Advocate I

I get the same error in a flow when I try to start an approval with a mail-enabled security group:

BadRequest. Fehler bei Anforderung. Fehlercode: "XrmApiRequestFailed". Fehlermeldung: "Fehler bei XRM-API-Anforderung: "Message: Duplicate record exists. Cannot insert duplicate key row in object 'dbo.TeamBase' with unique index 'ndx_TeamName_BusinessUnitId'. The duplicate key value is <redacted>. Code: 0x8004022a InnerError: ".".

Kevin_Centric
Frequent Visitor

@aboehm We're getting the same error when trying to send approvals to a mail enabled O365 group. Did you ever find a solution/explanation for this problem? 

aboehm
Advocate I
Advocate I

@Kevin_Centric Unfortunately no, I had not found any solution nor any explanation for this issue. Instead I created a workaround by allowing multiple "assignedTo" addresses for the approvals in my flow, so there was no longer a need for the mail-enabled security group.

It isn't ideal because theses addresses come from a single SharePoint column, which i can't restrict to only "usable" addresses. So some users may enter data which let the flow just explode instead of displaying a message to the user in an expectable error condition.

I decided to implement a workaround as well.
The setup looks the same as the one you're describing, with the addresses coming from a SP list.
Instead of having the customer add the addresses for every user which needs to receive a approval we decided to keep using the O365 groups. However, instead of sending the approvals to the group directly we use the O365 Groups connector to retrieve the group and its members based on the mail address in the SP list.
We then append all group members email addresses' to a string, which is used as the "recipients" value in the approval.

This way the solution will stay flexible and won't require additional maintenance from the customer.
As an added bonus end user now receive the approval in Teams as well, which according to the docs isn't currently supported when using O365 groups directly.

 

I did contact Microsoft support, which said is probably had something to do with the rights of the users within the security group, referring to Azure support for further investigation. As the workaround was pretty simple to implement and also provides a better UX I've not gone into any further investigation. 

Could you give some screenshots to show how you did these things? I'm struggling with the same thing, and I'm not exactly sure how to do what you are explaining with pulling the members based on a SP list and then turning it into a string for the approval recipient.  I would appreciate it very much!

Hi @cassie_williams , Sorry, I only just saw your question. Here's what we did:
1. Retrieve a certain O365 group mail address from the SP list

Screenshot_508.png

2. Write the first result a variable (needed in our solution to keep the flow clean)

The first() function is needed here because the "Get Items"-action will return an array even when there's only one result. [EmailAdresses] happens to be the (wrongly spelled) name of the SP column, containing the O365 groups mail address.

Screenshot_509.png

3. Find the group ID of the O365 group, based on the mail address

4. Retrieve the members of the O365 group, using the O365 group ID. (again, using the first result from the prior action)

Screenshot_510.png

5. Using an Apply to each, running through all O365 group members one by one, append all mail members' mail addresses to a string variable, adding ";" between them.

Screenshot_511.png

6. Send the approval, using the string containing all mail addresses as the "Assigned to"

Screenshot_512.png

 

Hopefully this helps clearing some things up. If you need any further explanation, please let me know.

 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,580)