簡體   English   中英

在Windows 2000之后使用System.DirectoryServices.AccountManagement設置Active Directory用戶登錄名

[英]Setting Active Directory user login name post Windows 2000 with System.DirectoryServices.AccountManagement

我如何使用System.DirectoryServices.AccountManagement屏幕截圖(在Windows 2000之后)下面紅色標記的用戶登錄名?

在此處輸入圖片說明

用戶是從UserPrincipal對象創建的,但是我看不到任何屬性或mutator方法可以這樣做:

using (var user = new UserPrincipal(context)) {
    user.SamAccountName = samAccountName;
    user.GivenName = fname;
    user.Surname = lname;
    user.EmailAddress = email;
    user.SetPassword(password);
    user.Enabled = true;
    user.Save();
}

試試: user.UserPrincipalName

SamAccountName是Win2000之前的名稱。

MSDN參考

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM