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();