1
我无法从组中删除用户。我没有问题添加用户。我没有收到myGroup.Members.Remove(用户为DirectoryObject);的任何错误。这是一个错误吗?Azure图api客户端从组中删除成员
ActiveDirectoryClient client = AuthenticationHelper.GetActiveDirectoryClient();
User user = (User)await client.Users.GetByObjectId(userID).ExecuteAsync();
IGroup myIGroup = await client.Groups.GetByObjectId(objectId).ExecuteAsync();
Group myGroup = (Group)myIGroup;
if (myGroup != null && user != null)
{
try
{
switch (myAction)
{
case "Delete":
myGroup.Members.Remove(user as DirectoryObject);
break;
case "Add":
myGroup.Members.Add(user as DirectoryObject);
break;
}
await myGroup.UpdateAsync();