共用方式為


移除群組成員

只要移除群組成員屬性中的成員辨別名稱,就可以移除群組成員。若要移除辨別名稱,請使用要移除之成員的辨別名稱呼叫 Remove 方法。如需成員屬性的詳細資訊,請參閱 MSDN Library (https://go.microsoft.com/fwlink/?LinkID=27252 (本頁面可能為英文)) 之 Active Directory Schema SDK 文件中的<成員>主題 (可能為英文網頁)。

下列範例示範如何移除群組成員。您可以先尋找要移除的使用者,然後呼叫 Remove 方法,以完成這項工作。

// Bind to the group.
DirectoryEntry group = new DirectoryEntry(groupDN);

// Remove the user from the group.
group.Properties["member"].Remove(userDN);

// Commit the changes to the directory.
group.CommitChanges();

請參閱

參考

PropertyValueCollection
System.DirectoryServices

概念

群組管理

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation.All rights reserved.