更新时间:2023-12-01 15:52:16
既然你是在.NET 4中,你可以使用 System.DirectoryServices.AccountManagement
(S .DS.AM)命名空间。阅读所有关于它的:
Since you're on .NET 4, you can use the System.DirectoryServices.AccountManagement
(S.DS.AM) namespace. Read all about it here:
基本上,你可以定义域范围内,并很容易地找到在AD用户和/或组:
Basically, you can define a domain context and easily find users and/or groups in AD:
// set up domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
// find currently logged in user
UserPrincipal user = UserPrincipal.Current;
string displayName = user.DisplayName;
新S.DS.AM使得它可以很容易地玩弄用户和组AD。
The new S.DS.AM makes it really easy to play around with users and groups in AD.