UserPrincipal 생성자

정의

UserPrincipal 클래스의 새 인스턴스를 초기화합니다.

오버로드

UserPrincipal(PrincipalContext)

지정된 컨텍스트를 사용하여 UserPrincipal 클래스의 새 인스턴스를 초기화합니다.

UserPrincipal(PrincipalContext, String, String, Boolean)

지정된 컨텍스트, SAM 계정 이름, 암호 및 enabled 값을 사용하여 UserPrincipal 클래스의 새 인스턴스를 초기화합니다.

UserPrincipal(PrincipalContext)

Source:
User.cs
Source:
User.cs
Source:
User.cs

지정된 컨텍스트를 사용하여 UserPrincipal 클래스의 새 인스턴스를 초기화합니다.

public:
 UserPrincipal(System::DirectoryServices::AccountManagement::PrincipalContext ^ context);
public UserPrincipal (System.DirectoryServices.AccountManagement.PrincipalContext context);
new System.DirectoryServices.AccountManagement.UserPrincipal : System.DirectoryServices.AccountManagement.PrincipalContext -> System.DirectoryServices.AccountManagement.UserPrincipal
Public Sub New (context As PrincipalContext)

매개 변수

context
PrincipalContext

작업이 수행되는 서버 또는 도메인을 지정하는 PrincipalContext입니다.

예제

다음 코드 예제에서는 생성자에서 초기화된 사용자 이름 및 암호를 사용하여 LDAP 도메인 "fabrikam.com"에 PrincipalContext 연결하여 "administrator" 및 "securelyStoredPassword"에 연결합니다.

예제에 설정된 속성(예: 사용자 이름 및 전자 메일 주소)은 생성자에 지정된 PrincipalContext 컨테이너 아래에 생성됩니다. "CN=Users,DC=fabrikam,DC=com."

PrincipalContext ctx = new PrincipalContext(  
                                         ContextType.Domain,  
                                         "fabrikam.com",   
                                         "CN=Users,DC=fabrikam,DC=com",  
                                         "administrator",   
                                         "securelyStoredPassword");   

UserPrincipal usr = new UserPrincipal(ctx);  

usr.Name = "Jim Daly";  
usr.Description = "This is the user account for Jim Daly";  
usr.EmailAddress = "jimdaly@fabrikam.com";  
usr.SetPassword("securelyStoredPassword");  
usr.Save();  

usr.Dispose();  
ctx.Dispose();   

설명

사용자 계정 생성 시 유지 되지 않습니다. 계정을 저장하려면 메서드를 호출합니다 Save .

적용 대상

UserPrincipal(PrincipalContext, String, String, Boolean)

Source:
User.cs
Source:
User.cs
Source:
User.cs

지정된 컨텍스트, SAM 계정 이름, 암호 및 enabled 값을 사용하여 UserPrincipal 클래스의 새 인스턴스를 초기화합니다.

public:
 UserPrincipal(System::DirectoryServices::AccountManagement::PrincipalContext ^ context, System::String ^ samAccountName, System::String ^ password, bool enabled);
public UserPrincipal (System.DirectoryServices.AccountManagement.PrincipalContext context, string samAccountName, string password, bool enabled);
new System.DirectoryServices.AccountManagement.UserPrincipal : System.DirectoryServices.AccountManagement.PrincipalContext * string * string * bool -> System.DirectoryServices.AccountManagement.UserPrincipal
Public Sub New (context As PrincipalContext, samAccountName As String, password As String, enabled As Boolean)

매개 변수

context
PrincipalContext

작업이 수행되는 서버 또는 도메인을 지정하는 PrincipalContext입니다.

samAccountName
String

이 사용자 보안 주체에 대한 SAM 계정 이름입니다.

password
String

이 계정의 암호입니다.

enabled
Boolean

계정을 사용할지 여부를 지정하는 부울 값입니다.

설명

사용자 계정 생성 시 유지 되지 않습니다. 계정을 저장하려면 메서드를 호출합니다 Save .

적용 대상