如何更新Userprincipal中的部门,经理属性?

时间:2014-10-23 13:23:14

标签: c# active-directory active-directory-group principal activedirectorymembership

我无法完成更新域名帐户信息的操作,如“公司”,“经理”,“部门”等。

以下是我的两种方式

1: DirectoryEntry de = new DirectoryEntry(“LDAP://”);

    de.InvokeSet("company", new Object[] { "UpdateCompany" });
       de.Username = "testname";
       de.Password = "test@6789";
       de.AuthenticationType = AuthenticationTypes.Secure;
       de.CommitChanges();

2:  UserPrincipal up = new UserPrincipal(insPrincipalContext);        up.Name =“ lijen ”;

   PrincipalSearcher insPrincipalSearcher = new PrincipalSearcher();
   insPrincipalSearcher.QueryFilter = up;
   PrincipalSearchResult<Principal> results = insPrincipalSearcher.FindAll();

way1不起作用,用户的公司不再改变!为什么呢?

没有获得UserPricipal对象更新公司属性的方法。请帮忙!非常感谢。

0 个答案:

没有答案