1
votes

I'm trying to create a dynamic distribution group using Microsoft Graph API but it always results to an error:

POST https://graph.microsoft.com/v1.0/groups

{
  "displayName": "Dynamic Group",
  "groupTypes": ["DynamicMembership"],
  "mailNickname": "dynamic1",
  "mailEnabled": true,
  "securityEnabled": false
}

Result:

{
  "error": {
    "code": "Request_BadRequest",
    "message": "The service does not currently support writes of mail-enabled groups. Please ensure that the mail-enablement property is unset and the security-enablement property is set.",
    "innerError": {
      "request-id": "748bcafc-f655-463c-b8d3-4ffc55307232",
      "date": "2016-09-13T13:23:36"
    }
  }
}

Interestingly, when I add "Unified" to groupTypes, it shows a different errors:

{
  "displayName": "Dynamic Group",
  "groupTypes": ["DynamicMembership","Unified"],
  "mailNickname": "dynamic1",
  "mailEnabled": true,
  "securityEnabled": false
}

Result:

{
  "error": {
    "code": "Request_BadRequest",
    "message": "A value is required for property 'MembershipRule'.",
    "innerError": {
      "request-id": "58c5d344-c69b-4c9b-8997-28df35c78cb8",
      "date": "2016-09-13T13:24:43"
    }
  }
}

However I couldn't find any documentation about the 'MembershipRule' field.

If I just use the "Unified" group type, it succeeds. But what I need is "DynamicMembership"

{
  "displayName": "Test 5",
  "groupTypes": ["Unified"],
  "mailNickname": "test5",
  "mailEnabled": true,
  "securityEnabled": false
}

Is it possible to create dynamic distribution groups using Microsoft Graph API? Here is the documentation: http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/group_post_groups

1

1 Answers

1
votes

Currently, Microsoft Graph API cannot be used to create groups with dynamic membership. We are working on enabling the feature and it should be available soon. Till then, please use the Azure portal to create such groups.