PrincipalContext コンストラクター

定義

PrincipalContext クラスの新しいインスタンスを初期化します。

オーバーロード

PrincipalContext(ContextType)

指定したコンテキストの種類を使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

PrincipalContext(ContextType, String)

指定したコンテキスト タイプと名前を使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

PrincipalContext(ContextType, String, String)

指定したコンテキスト タイプ、名前、およびコンテナーを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

PrincipalContext(ContextType, String, String, ContextOptions)

指定したコンテキスト タイプ、名前、コンテナー、およびコンテキスト オプションを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

PrincipalContext(ContextType, String, String, String)

指定したコンテキスト タイプ、名前、ユーザー名、およびパスワードを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

PrincipalContext(ContextType, String, String, String, String)

指定したコンテキスト タイプ、名前、コンテナー、ユーザー名、およびパスワードを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

PrincipalContext(ContextType, String, String, ContextOptions, String, String)

指定したコンテキスト タイプ、名前、コンテナー、コンテキスト オプション、ユーザー名、およびパスワードを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

注釈

コンストラクターは PrincipalContext パラメーターとサーバーの検証を実行しますが、資格情報の検証は試みません。

コンテナーを指定せずにプリンシパル コンテキスト オブジェクトを作成する場合は、複数の個別のコンテナーを表すために使用できます。 1 つのコンテナーをクエリ操作のベースとして使用できますが、追加のコンテナーには新しく作成されたプリンシパル オブジェクトを保持できます。 たとえば、ユーザーまたはグループがドメイン コンテキストの種類に挿入されると、アカウント管理 API は既定の既知のユーザー コンテナー "CN=Users,DC=Fabrikam,DC=com" を使用します。 コンピューターがストアに挿入されると、API は既定の "CN=Computers,DC=Fabrikam,DC=com" コンテナーを使用します。 既定のコンテナー名はドメイン管理者が変更できることに注意してください。 プリンシパル オブジェクト コンストラクターは 1 つのプリンシパル コンテキストのみを指定できるため、アプリケーションがコンテナーを指定せずにドメイン コンテキストを作成すると、追加のコンテキストが既定の動作として公開されます。 アプリケーション ディレクトリには既知のコンテナーがないため、アプリケーションはコンストラクターでコンテナーを指定する必要があります。または、 ArgumentException がスローされます。 SAM にはコンテナーがないため、 ArgumentException アプリケーションがコンストラクターでコンテナーを指定しようとすると、 がスローされます。

ユーザー名をパラメーターとして受け取るコンストラクターの各バージョンでは、文字列は userName さまざまな形式にすることができます。 でサポートされている 3 つの NameFormats は、Nt4Name、UserPrincipalName、SamAccountName です。 名前の形式の詳細については、 ADS_NAME_TYPE_ENUMドキュメントを参照してください

PrincipalContext(ContextType)

ソース:
Context.cs
ソース:
Context.cs
ソース:
Context.cs

指定したコンテキストの種類を使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

public:
 PrincipalContext(System::DirectoryServices::AccountManagement::ContextType contextType);
public PrincipalContext (System.DirectoryServices.AccountManagement.ContextType contextType);
new System.DirectoryServices.AccountManagement.PrincipalContext : System.DirectoryServices.AccountManagement.ContextType -> System.DirectoryServices.AccountManagement.PrincipalContext
Public Sub New (contextType As ContextType)

パラメーター

contextType
ContextType

プリンシパル コンテキストのストアのタイプを指定する ContextType 列挙値。

例外

アプリケーション ディレクトリ コンテキストを使用する場合は、名前またはコンテナーを指定する必要があります。

contextType パラメーターに、有効な ContextType 列挙値が格納されていません。

適用対象

PrincipalContext(ContextType, String)

ソース:
Context.cs
ソース:
Context.cs
ソース:
Context.cs

指定したコンテキスト タイプと名前を使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

public:
 PrincipalContext(System::DirectoryServices::AccountManagement::ContextType contextType, System::String ^ name);
public PrincipalContext (System.DirectoryServices.AccountManagement.ContextType contextType, string name);
new System.DirectoryServices.AccountManagement.PrincipalContext : System.DirectoryServices.AccountManagement.ContextType * string -> System.DirectoryServices.AccountManagement.PrincipalContext
Public Sub New (contextType As ContextType, name As String)

パラメーター

contextType
ContextType

プリンシパル コンテキストのストアのタイプを指定する ContextType 列挙値。

name
String

Domain コンテキスト タイプのドメインまたはサーバーの名前、Machine コンテキスト タイプのコンピューター名、または ApplicationDirectory インスタンスをホストするサーバーおよびポートの名前。

名前が Domain コンテキスト タイプで null の場合、このコンテキストはスレッドが実行されるユーザー プリンシパルのドメインに対するドメイン コントローラーになります。 名前が Machine コンテキスト タイプで null の場合、これはローカル コンピューター名になります。 このパラメーターは、ApplicationDirectory コンテキスト タイプでは null にすることはできません。

例外

contextType パラメーターで ApplicationDirectory を指定した場合は、名前を指定する必要があります。

contextType パラメーターに、有効な ContextType 列挙値が格納されていません。

適用対象

PrincipalContext(ContextType, String, String)

ソース:
Context.cs
ソース:
Context.cs
ソース:
Context.cs

指定したコンテキスト タイプ、名前、およびコンテナーを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

public:
 PrincipalContext(System::DirectoryServices::AccountManagement::ContextType contextType, System::String ^ name, System::String ^ container);
public PrincipalContext (System.DirectoryServices.AccountManagement.ContextType contextType, string name, string container);
new System.DirectoryServices.AccountManagement.PrincipalContext : System.DirectoryServices.AccountManagement.ContextType * string * string -> System.DirectoryServices.AccountManagement.PrincipalContext
Public Sub New (contextType As ContextType, name As String, container As String)

パラメーター

contextType
ContextType

プリンシパル コンテキストのストアのタイプを指定する ContextType 列挙値。

name
String

Domain コンテキスト タイプのドメインまたはサーバーの名前、Machine コンテキスト タイプのコンピューター名、または ApplicationDirectory インスタンスをホストするサーバーおよびポートの名前。

名前が Domain コンテキスト タイプで null の場合、このコンテキストはスレッドが実行されるユーザー プリンシパルのドメインに対するドメイン コントローラーになります。 名前が Machine コンテキスト タイプで null の場合、これはローカル コンピューター名になります。 このパラメーターは、ApplicationDirectory コンテキスト タイプでは null にすることはできません。

container
String

コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入はこのコンテナーに対して実行されます。

Domain コンテキスト タイプおよび ApplicationDirectory コンテキスト タイプの場合、このパラメーターはコンテナー オブジェクトの識別名になります。

Machine コンテキスト タイプの場合、このパラメーターを null に設定する必要があります。

例外

contextType パラメーターで Machine コンテキスト タイプを指定した場合は、コンテナーを指定できません。

contextType パラメーターで ApplicationDirectory を指定した場合は、名前またはコンテナーを指定する必要があります。

contextType パラメーターに、有効な ContextType 列挙値が格納されていません。

注釈

InvalidOperationExceptionプリンシパル コンテキストに指定されたDomainコンテナーが有効なコンテナーでない場合は、サーバーに接続する後続のディレクトリ操作呼び出しで がスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その possibleInferiors 属性で定義されます。

適用対象

PrincipalContext(ContextType, String, String, ContextOptions)

ソース:
Context.cs
ソース:
Context.cs
ソース:
Context.cs

指定したコンテキスト タイプ、名前、コンテナー、およびコンテキスト オプションを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

public:
 PrincipalContext(System::DirectoryServices::AccountManagement::ContextType contextType, System::String ^ name, System::String ^ container, System::DirectoryServices::AccountManagement::ContextOptions options);
public PrincipalContext (System.DirectoryServices.AccountManagement.ContextType contextType, string name, string container, System.DirectoryServices.AccountManagement.ContextOptions options);
new System.DirectoryServices.AccountManagement.PrincipalContext : System.DirectoryServices.AccountManagement.ContextType * string * string * System.DirectoryServices.AccountManagement.ContextOptions -> System.DirectoryServices.AccountManagement.PrincipalContext
Public Sub New (contextType As ContextType, name As String, container As String, options As ContextOptions)

パラメーター

contextType
ContextType

プリンシパル コンテキストのストアのタイプを指定する ContextType 列挙値。

name
String

Domain コンテキスト タイプのドメインまたはサーバーの名前、Machine コンテキスト タイプのコンピューター名、または ApplicationDirectory インスタンスをホストするサーバーおよびポートの名前。

名前が Domain コンテキスト タイプで null の場合、このコンテキストはスレッドが実行されるユーザー プリンシパルのドメインに対するドメイン コントローラーになります。 名前が Machine コンテキスト タイプで null の場合、これはローカル コンピューター名になります。 このパラメーターは、ApplicationDirectory コンテキスト タイプでは null にすることはできません。

container
String

コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入はこのコンテナーに対して実行されます。

Domain コンテキスト タイプおよび ApplicationDirectory コンテキスト タイプの場合、このパラメーターはコンテナー オブジェクトの識別名になります。

Machine コンテキスト タイプの場合、このパラメーターを null に設定する必要があります。

options
ContextOptions

サーバーへのバインドに使用するオプションを指定する 1 つ以上の ContextOptions 列挙値の組み合わせ。 このパラメーターが null の場合、既定のオプションは ContextOptions.Negotiate | ContextOptions.Signing | ContextOptions.Sealing です。

例外

contextType パラメーターで Machine コンテキスト タイプを指定した場合は、コンテナーを指定できません。

contextType パラメーターで ApplicationDirectory を指定した場合は、名前またはコンテナーを指定する必要があります。

contextType パラメーターに、有効な ContextType 列挙値が格納されていません。

options パラメーターに、有効な ContextOptions 列挙値の組み合わせが格納されていません。

注釈

InvalidOperationExceptionプリンシパル コンテキストに指定されたDomainコンテナーが有効なコンテナーでない場合は、サーバーに接続する後続のディレクトリ操作呼び出しで がスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その possibleInferiors 属性で定義されます。

適用対象

PrincipalContext(ContextType, String, String, String)

ソース:
Context.cs
ソース:
Context.cs
ソース:
Context.cs

指定したコンテキスト タイプ、名前、ユーザー名、およびパスワードを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

public:
 PrincipalContext(System::DirectoryServices::AccountManagement::ContextType contextType, System::String ^ name, System::String ^ userName, System::String ^ password);
public PrincipalContext (System.DirectoryServices.AccountManagement.ContextType contextType, string name, string userName, string password);
new System.DirectoryServices.AccountManagement.PrincipalContext : System.DirectoryServices.AccountManagement.ContextType * string * string * string -> System.DirectoryServices.AccountManagement.PrincipalContext
Public Sub New (contextType As ContextType, name As String, userName As String, password As String)

パラメーター

contextType
ContextType

プリンシパル コンテキストのストアのタイプを指定する ContextType 列挙値。

name
String

Domain コンテキスト タイプのドメインまたはサーバーの名前、Machine コンテキスト タイプのコンピューター名、または ApplicationDirectory インスタンスをホストするサーバーおよびポートの名前。

名前が Domain コンテキスト タイプで null の場合、このコンテキストはスレッドが実行されるユーザー プリンシパルのドメインに対するドメイン コントローラーになります。 名前が Machine コンテキスト タイプで null の場合、これはローカル コンピューター名になります。 このパラメーターは、ApplicationDirectory コンテキスト タイプでは null にすることはできません。

userName
String

ストアへの接続に使用するユーザー名。 userName パラメーターと password パラメーターがどちらも null の場合、現在のプロセスの資格情報が使用されます。 そうでない場合は、userNamepassword のどちらも null でないことが必要です。それらのパラメーターが指定する資格情報がストアへの接続に使用されます。

password
String

ストアの接続に使用するパスワード。 userName パラメーターと password パラメーターがどちらも null の場合、現在のプロセスの資格情報が使用されます。 そうでない場合は、userNamepassword のどちらも null でないことが必要です。それらのパラメーターが指定する資格情報がストアへの接続に使用されます。

例外

username パラメーターと password パラメーターは、null であるか、値を格納している必要があります。

contextType パラメーターで ApplicationDirectory を指定した場合は、名前を指定する必要があります。

contextType パラメーターに、有効な ContextType 列挙値が格納されていません。

適用対象

PrincipalContext(ContextType, String, String, String, String)

ソース:
Context.cs
ソース:
Context.cs
ソース:
Context.cs

指定したコンテキスト タイプ、名前、コンテナー、ユーザー名、およびパスワードを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

public:
 PrincipalContext(System::DirectoryServices::AccountManagement::ContextType contextType, System::String ^ name, System::String ^ container, System::String ^ userName, System::String ^ password);
public PrincipalContext (System.DirectoryServices.AccountManagement.ContextType contextType, string name, string container, string userName, string password);
new System.DirectoryServices.AccountManagement.PrincipalContext : System.DirectoryServices.AccountManagement.ContextType * string * string * string * string -> System.DirectoryServices.AccountManagement.PrincipalContext
Public Sub New (contextType As ContextType, name As String, container As String, userName As String, password As String)

パラメーター

contextType
ContextType

プリンシパル コンテキストのストアのタイプを指定する ContextType 列挙値。

name
String

Domain コンテキスト タイプのドメインまたはサーバーの名前、Machine コンテキスト タイプのコンピューター名、または ApplicationDirectory インスタンスをホストするサーバーおよびポートの名前。

名前が Domain コンテキスト タイプで null の場合、このコンテキストはスレッドが実行されるユーザー プリンシパルのドメインに対するドメイン コントローラーになります。 名前が Machine コンテキスト タイプで null の場合、これはローカル コンピューター名になります。 このパラメーターは、ApplicationDirectory コンテキスト タイプでは null にすることはできません。

container
String

コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入はこのコンテナーに対して実行されます。

Domain コンテキスト タイプおよび ApplicationDirectory コンテキスト タイプの場合、このパラメーターはコンテナー オブジェクトの識別名になります。

Machine コンテキスト タイプの場合、このパラメーターを null に設定する必要があります。

userName
String

ストアへの接続に使用するユーザー名。 userName パラメーターおよび password パラメーターがどちらも null の場合、現在のプリンシパルの既定の資格情報が使用されます。 そうでない場合は、userNamepassword のどちらも null でないことが必要です。それらのパラメーターが指定する資格情報がストアへの接続に使用されます。

password
String

ストアの接続に使用するパスワード。 userName パラメーターおよび password パラメーターがどちらも null の場合、現在のプリンシパルの既定の資格情報が使用されます。 そうでない場合は、userNamepassword のどちらも null でないことが必要です。それらのパラメーターが指定する資格情報がストアへの接続に使用されます。

例外

username パラメーターと password パラメーターは、null であるか、値を格納している必要があります。

contextType パラメーターで Machine コンテキスト タイプを指定した場合は、コンテナーを指定できません。

name パラメーターで ApplicationDirectory を指定した場合は、container または contextType を指定する必要があります。

contextType パラメーターに、有効な ContextType 列挙値が格納されていません。

注釈

InvalidOperationExceptionプリンシパル コンテキストに指定されたDomainコンテナーが有効なコンテナーでない場合は、サーバーに接続する後続のディレクトリ操作呼び出しで がスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その possibleInferiors 属性で定義されます。

適用対象

PrincipalContext(ContextType, String, String, ContextOptions, String, String)

ソース:
Context.cs
ソース:
Context.cs
ソース:
Context.cs

指定したコンテキスト タイプ、名前、コンテナー、コンテキスト オプション、ユーザー名、およびパスワードを使用して、PrincipalContext クラスの新しいインスタンスを初期化します。

public:
 PrincipalContext(System::DirectoryServices::AccountManagement::ContextType contextType, System::String ^ name, System::String ^ container, System::DirectoryServices::AccountManagement::ContextOptions options, System::String ^ userName, System::String ^ password);
public PrincipalContext (System.DirectoryServices.AccountManagement.ContextType contextType, string name, string container, System.DirectoryServices.AccountManagement.ContextOptions options, string userName, string password);
new System.DirectoryServices.AccountManagement.PrincipalContext : System.DirectoryServices.AccountManagement.ContextType * string * string * System.DirectoryServices.AccountManagement.ContextOptions * string * string -> System.DirectoryServices.AccountManagement.PrincipalContext
Public Sub New (contextType As ContextType, name As String, container As String, options As ContextOptions, userName As String, password As String)

パラメーター

contextType
ContextType

プリンシパル コンテキストのストアのタイプを指定する ContextType 列挙値。

name
String

Domain コンテキスト タイプのドメインまたはサーバーの名前、Machine コンテキスト タイプのコンピューター名、または ApplicationDirectory インスタンスをホストするサーバーおよびポートの名前。

名前が Domain コンテキスト タイプで null の場合、このコンテキストはスレッドが実行されるユーザー プリンシパルのドメインに対するドメイン コントローラーになります。 名前が Machine コンテキスト タイプで null の場合、これはローカル コンピューター名になります。 このパラメーターは、ApplicationDirectory コンテキスト タイプでは null にすることはできません。

container
String

コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入はこのコンテナーに対して実行されます。

Domain コンテキスト タイプおよび ApplicationDirectory コンテキスト タイプの場合、このパラメーターはコンテナー オブジェクトの識別名になります。

Machine コンテキスト タイプの場合、このパラメーターを null に設定する必要があります。

options
ContextOptions

サーバーへのバインドに使用するオプションを指定する 1 つ以上の ContextOptions 列挙値の組み合わせ。 このパラメーターが null の場合、既定のオプションは ContextOptions.Negotiate | ContextOptions.Signing | ContextOptions.Sealing です。

userName
String

ストアへの接続に使用するユーザー名。 userName パラメーターおよび password パラメーターがどちらも null の場合、現在のプリンシパルの既定の資格情報が使用されます。 そうでない場合は、userNamepassword のどちらも null でないことが必要です。それらのパラメーターが指定する資格情報がストアへの接続に使用されます。

password
String

ストアの接続に使用するパスワード。 userName パラメーターおよび password パラメーターがどちらも null の場合、現在のプリンシパルの既定の資格情報が使用されます。 そうでない場合は、userNamepassword のどちらも null でないことが必要です。それらのパラメーターが指定する資格情報がストアへの接続に使用されます。

例外

username パラメーターと password パラメーターは、null であるか、値を格納している必要があります。

contextType パラメーターで Machine コンテキスト タイプを指定した場合は、コンテナーを指定できません。

contextType パラメーターで ApplicationDirectory を指定した場合は、名前またはコンテナーを指定する必要があります。

contextType パラメーターに、有効な ContextType 列挙値が格納されていません。

options パラメーターに、有効な ContextOptions 列挙値の組み合わせが格納されていません。

注釈

InvalidOperationExceptionプリンシパル コンテキストに指定されたDomainコンテナーが有効なコンテナーでない場合は、サーバーに接続する後続のディレクトリ操作呼び出しで がスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その possibleInferiors 属性で定義されます。

適用対象