【发布时间】:2013-01-11 12:31:36
【问题描述】:
我想从用户那里获取 Active Directory 属性并且我想使用System.DirectoryServices.AccountManagement。
我的代码:
public static void GetUserProperties(string dc,string user)
{
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, dc);
UserPrincipal u = UserPrincipal.FindByIdentity(ctx, user);
string firstname = u.GivenName;
string lastname = u.Surname;
string email = u.EmailAddress;
string telephone = u.VoiceTelephoneNumber;
...//how I can get company and other properties?
}
【问题讨论】:
-
公司是什么意思?
-
我也需要同样的方法而不使用扩展方法以获得更简单的解决方案。
标签: c# properties active-directory principal userprincipal