Microsoft graph api 将成员添加到组时出错:“0”;无法更新源自外部服务的对象的指定属性;

Microsoft graph api 将成员添加到组时出错:“0”;无法更新源自外部服务的对象的指定属性;,microsoft-graph-api,Microsoft Graph Api,用于将成员添加到组中 POST /groups/{id}/members/$ref { "@odata.id": "https://graph.microsoft.com/v1.0/users/xxx@yyy.com" } 返回错误 { "error": { "code": "Request_BadRequest", "message": "Unable to update the specified properties for objects tha

用于将成员添加到组中

POST /groups/{id}/members/$ref
{
"@odata.id": "https://graph.microsoft.com/v1.0/users/xxx@yyy.com"
}
返回错误

{
    "error": {
        "code": "Request_BadRequest",
        "message": "Unable to update the specified properties for objects that have originated within an external service."
    }
}
我尝试添加到的组具有以下属性:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups/$entity",
    "id": "xxx",
    "deletedDateTime": null,
    "classification": null,
    "createdDateTime": "2017-09-11T21:04:49Z",
    "description": null,
    "displayName": "xxx",
    "groupTypes": [],
    "mail": "xxx@yyy.com",
    "mailEnabled": true,
    "mailNickname": "xxx",
    "onPremisesLastSyncDateTime": null,
    "onPremisesProvisioningErrors": [],
    "onPremisesSecurityIdentifier": null,
    "onPremisesSyncEnabled": null,
    "preferredDataLocation": null,
    "proxyAddresses": [
        "smtp:xxx@yyy.com",
        "SMTP:xxx@yyy.com"
    ],
    "renewedDateTime": "2017-09-11T21:04:49Z",
    "securityEnabled": false,
    "visibility": null
}

我的测试结果供你参考。

列出用户ID以便获取用户ID

https://graph.microsoft.com/v1.0/users

发现拒绝的原因是Microsoft只允许向Office 365组添加成员(groupTypes=[“Unified”])

在我的例子中,上面的组属性显示(groupTypes=[])