如何获得Active Directory属性不能再由UserPrincipal类psented $ P $再由、如何获得、属性、Active

2023-09-09 21:34:16 作者:帝王念

我的意思是,现在我使用System.DirectoryServices.AccountManagement,如果我使用UserPrincipal类我只看到名字,中间名等

What I mean is that right now I am using System.DirectoryServices.AccountManagement and if I use UserPrincipal class I only see the Name, Middle Name, etc

所以在我的codeS像

so in my codes it like

UserPrincipal myUser = new UserPrincipal(pc);
myUser.Name = "aaaaaa";
myUser.SamAccountName = "aaaaaaa";
.
.
.
.
myUser.Save();

我怎么会看到属性,如移动或信息?

How would I see the attribute like mobile or info?

推荐答案

做的正确的方法是使用,你扩展你所追求的校长和使用方法ExtensionSet和ExtensionGet如下解释PrincipalExtensions http://anyrest.word$p$pss.com/2010/10/14/how-to-use-ad-attributes-not-re$p$psented-in-userprincipal-groupprincipal-and-computerprincipal/

The proper way of doing it is by using PrincipalExtensions where you Extend the Principal you are after and use the methods ExtensionSet and ExtensionGet as explained here http://anyrest.wordpress.com/2010/10/14/how-to-use-ad-attributes-not-represented-in-userprincipal-groupprincipal-and-computerprincipal/