在Azure AD中将成员添加到组时出现此问题,收到以下错误消息:
无法更新内部控制的指定属性 目录同步对象或当前正在进行迁移的对象
我正在尝试将现有的azure AD成员添加到现有组中,但我收到的回复是“错误请求”。对于某些调用,updateasync工作正常,但成员未添加到组。我提供了我的代码,我正在尝试我正在得到的错误。明确建议,如果任何人面对相同并解决它。谢谢。
代码: -
IUser newUser = await GetUser(userKey);
Microsoft.Azure.ActiveDirectory.GraphClient.Group retrievedGroup = new Microsoft.Azure.ActiveDirectory.GraphClient.Group();
List<IGroup> foundGroups = null;
foundGroups = adClient.Groups
.Where(group => group.DisplayName.StartsWith(groupName))
.ExecuteAsync().Result.CurrentPage.ToList();
if (foundGroups != null && foundGroups.Count > 0)
{
retrievedGroup = foundGroups.First() as Microsoft.Azure.ActiveDirectory.GraphClient.Group;
}
if (retrievedGroup.ObjectId != null)
{
retrievedGroup.Members.Add(newUser as DirectoryObject);
await retrievedGroup.UpdateAsync();
}
错误: -
{"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"Unable to update the specified properties for on-premises mastered Directory Sync objects or objects currently undergoing migration."},"date":"2016-10-18T08:02:22","requestId":"c757689c-6135-4198-9e4d-6a7aaa1135e7","values":null}}