Unable to create/modify Mail-enabled security groups via Microsoft Graph API.

Jerry Waldorf 6 Reputation points
2021-04-26T11:47:00.647+00:00

I'm unable to create/modify/add-remove users to Mail-enabled security groups. I was able to create/modify using powershell but i want to achieve this via API. How do i achieve this via API. Suggest me to resolve this issue. 2 problems using powershell in my case, 1. It is not returning Object Id when group created via powershell. 2. It doesn't reflect in system immediately.
Error while creating Group via API
{
'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': {
'date': '2021-04-22T05:09:50',
'request-id': '1a2f4780-a404-4cab-a482-e8603de244f3',
'client-request-id': '1a2f4780-a404-4cab-a482-e8603de244f3'
},
'details': [
{
'target': 'mailEnabled',
'code': 'InvalidValue'
}
]
}
}
While updating groups
{
'error': {
'code': 'Request_BadRequest',
'message': 'Unable to update the specified properties for objects that have originated within an external service.',
'innerError': {
'date': '2021-04-22T05:03:30',
'request-id': '341693ab-7cb6-47d8-8f1c-998e36b082d1',
'client-request-id': '341693ab-7cb6-47d8-8f1c-998e36b082d1'
}
}
}

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,036 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Vasil Michev 98,196 Reputation points MVP
    2021-04-26T12:04:30.22+00:00

    You cannot use the Graph API for that. Mail-enabled security groups are authored in Exchange Online, and Graph currently has no support for Exchange admin operations. Use PowerShell instead.

    1 person found this answer helpful.
    0 comments No comments