0

Using Microsoft Graph API 1.0 on an Azure AD B2C directory, I'm running into the following problem when creating groups.

I'm able to create a group with the following code

payload = {
    "description": group_name,
    "displayName": group_name,
    "groupTypes": [
        "Unified"
    ],
    "mailEnabled": False,
    "mailNickname": azure_user_id,
    "securityEnabled": True,
    "[email protected]": [Config.GRAPH_API_BASE + "users/" + azure_user_id],
    "[email protected]": [Config.GRAPH_API_BASE + "users/" + azure_user_id]
}

graph_api_post(Config.GRAPH_API_BASE + "groups", payload)

This creates a group with the specified name with a single owner who is also a member of the group.

However, having created one group this way, if I try to create a second group, with the same user, in the same manner, but with a different name, the API fails. In other words I can create:

Name: Group 1

Owner: "Me"

Members: "Me"

But when I try to create a second group as below, the API throws a 500 error.

Name: Group 2

Owner: "Me"

Members: "Me"

Using the Azure Portal, I'm able to create the second group, so this doesn't appear to be a limitation of groups in general, just a limitation / bug of the Graph API.

Is this limitation documented somewhere? Is there a workaround?

1
  • I can create the second group. Did you modify "mailNickname" to a new one? Commented Apr 1, 2020 at 1:22

1 Answer 1

2

Based on Properties of Group, mailNickname is unique in the organization.

So you should specify a different value for mailNickname. Otherwise you will get 500 error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.