C# 使用C获取thr AD组详细信息#
我需要使用C#根据组名或组电子邮件地址搜索Active Directory组详细信息。请在这方面帮助我。如果您使用的是.NET 3.5及更高版本,您应该查看C# 使用C获取thr AD组详细信息#,c#,active-directory,C#,Active Directory,我需要使用C#根据组名或组电子邮件地址搜索Active Directory组详细信息。请在这方面帮助我。如果您使用的是.NET 3.5及更高版本,您应该查看System.DirectoryServices.AccountManagement(S.DS.AM)命名空间。请在此处阅读所有相关内容: 基本上,您可以定义域上下文并在AD中轻松找到用户和/或组: // set up domain context using (PrincipalContext ctx = new Principal
System.DirectoryServices.AccountManagement
(S.DS.AM)命名空间。请在此处阅读所有相关内容:
// set up domain context
using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain))
{
// find the group in question
GroupPrincipal group = GroupPrincipal.FindByIdentity(ctx, "YourGroupNameHere");
// if found....
if (group != null)
{
// do whatever you need to do with the group
}
}
新的S.DS.AM使得在广告中与用户和群组进行互动变得非常容易 我已经试过了,但没有成功:(这是我的代码。如果我成功了,请告诉我。)wrong@user2150696:请更新您的原始问题以包含新代码!不要将代码放入注释中-真的很难阅读!