图 api 在启用邮件的组 "Unable to update the specified properties for objects that have originated within an external service." 上添加成员

Graph api add member on mail enabled group "Unable to update the specified properties for objects that have originated within an external service."

我一直在尝试编写一个使用 Graph api 来管理 AD 组的 MVC 应用程序。 我 运行 遇到的问题是,当我尝试向启用邮件的安全组添加或删除用户时,我得到 "Unable to update the specified properties for objects that have originated within an external service." 这些操作适用于 "normal" 个安全组。根据文档,它应该同时支持两者,我缺少什么?

代码:

bool userAdded = false;
        GraphServiceClient graphClient = GetAuthenticatedClient();
        try
        {
            var user = await graphClient.Users[userId].Request().GetAsync();
            await graphClient.Groups[groupId].Members.References.Request).AddAsync(user);
            Debug.WriteLine("Added user " + userId + " to the group: " + groupId);
            userAdded = true;
        }

启用邮件的安全组目前无法在 Azure AD 中直接更新,它们是从本地(如果您使用 Azure AD Connect 从本地目录同步)或从 Exchange Online 进行管理。