PrincipalContext コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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 つの NameFormat は、Nt4Name、UserPrincipalName、SamAccountName です。 名前の形式の詳細については、 ADS_NAME_TYPE_ENUMドキュメントを参照してください。
PrincipalContext(ContextType)
- ソース:
- Context.cs
- ソース:
- 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
- ソース:
- 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 インスタンスをホストするサーバーとポートの名前。
null コンテキストの名前がDomainの場合、このコンテキストは、スレッドが実行されているユーザー プリンシパルのドメインのドメイン コントローラーです。
null コンテキストの種類に対して名前がMachineされている場合、これはローカル コンピューター名です。 このパラメーターは、nullコンテキスト型に対してApplicationDirectoryできません。
例外
ApplicationDirectory パラメーターでcontextTypeを指定するときは、名前を指定する必要があります。
contextType パラメーターに有効なContextType列挙値が含まれていません。
適用対象
PrincipalContext(ContextType, String, String)
- ソース:
- Context.cs
- ソース:
- 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 インスタンスをホストするサーバーとポートの名前。
null コンテキストの名前がDomainの場合、このコンテキストは、スレッドが実行されているユーザー プリンシパルのドメインのドメイン コントローラーです。
null コンテキストの種類に対して名前がMachineされている場合、これはローカル コンピューター名です。 このパラメーターは、nullコンテキスト型に対してApplicationDirectoryできません。
- container
- String
コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入がこのコンテナーに実行されます。
DomainおよびApplicationDirectoryコンテキスト型の場合、このパラメーターはコンテナー オブジェクトの識別名です。
Machineコンテキスト型の場合、このパラメーターは null に設定する必要があります。
例外
Machine パラメーターでcontextType コンテキスト型を指定した場合、コンテナーを指定できません。
ApplicationDirectory パラメーターでcontextTypeを指定するときは、名前またはコンテナーを指定する必要があります。
contextType パラメーターに有効なContextType列挙値が含まれていません。
注釈
InvalidOperationExceptionは、Domain プリンシパル コンテキストに指定されたコンテナーが有効なコンテナーでない場合に、サーバーに接続する後続のディレクトリ操作呼び出しでスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その可能なInferiors 属性で定義されます。
適用対象
PrincipalContext(ContextType, String, String, ContextOptions)
- ソース:
- Context.cs
- ソース:
- 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 インスタンスをホストするサーバーとポートの名前。
null コンテキストの名前がDomainの場合、このコンテキストは、スレッドが実行されているユーザー プリンシパルのドメインのドメイン コントローラーです。
null コンテキストの種類に対して名前がMachineされている場合、これはローカル コンピューター名です。 このパラメーターは、nullコンテキスト型に対してApplicationDirectoryできません。
- container
- String
コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入がこのコンテナーに実行されます。
DomainおよびApplicationDirectoryコンテキスト型の場合、このパラメーターはコンテナー オブジェクトの識別名です。
Machineコンテキスト型の場合、このパラメーターは null に設定する必要があります。
- options
- ContextOptions
サーバーへのバインドに使用するオプションを指定する 1 つ以上の ContextOptions 列挙値の組み合わせ。 このパラメーターが nullの場合、既定のオプションは ContextOptions.Negotiate |ContextOptions.Signing |ContextOptions.Sealing。
例外
Machine パラメーターでcontextType コンテキスト型を指定した場合、コンテナーを指定できません。
ApplicationDirectory パラメーターでcontextTypeを指定するときは、名前またはコンテナーを指定する必要があります。
contextType パラメーターに有効なContextType列挙値が含まれていません。
options パラメーターには、有効なContextOptions列挙値の組み合わせが含まれていません。
注釈
InvalidOperationExceptionは、Domain プリンシパル コンテキストに指定されたコンテナーが有効なコンテナーでない場合に、サーバーに接続する後続のディレクトリ操作呼び出しでスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その可能なInferiors 属性で定義されます。
適用対象
PrincipalContext(ContextType, String, String, String)
- ソース:
- Context.cs
- ソース:
- 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 インスタンスをホストするサーバーとポートの名前。
null コンテキストの名前がDomainの場合、このコンテキストは、スレッドが実行されているユーザー プリンシパルのドメインのドメイン コントローラーです。
null コンテキストの種類に対して名前がMachineされている場合、これはローカル コンピューター名です。 このパラメーターは、nullコンテキスト型に対してApplicationDirectoryできません。
- userName
- String
ストアへの接続に使用するユーザー名。
userNameパラメーターとpassword パラメーターの両方がnullされている場合は、現在のプロセスの資格情報が使用されます。 それ以外の場合は、 userName と password の両方が null 以外である必要があり、指定した資格情報がストアへの接続に使用されます。
- password
- String
ストアへの接続に使用するパスワード。
userNameパラメーターとpassword パラメーターの両方がnullされている場合は、現在のプロセスの資格情報が使用されます。 それ以外の場合は、 userName と password の両方が null 以外である必要があり、指定した資格情報がストアへの接続に使用されます。
例外
userNameパラメーターとpassword パラメーターは、nullであるか、値を含む必要があります。
ApplicationDirectory パラメーターでcontextTypeを指定するときは、名前を指定する必要があります。
contextType パラメーターに有効なContextType列挙値が含まれていません。
適用対象
PrincipalContext(ContextType, String, String, String, String)
- ソース:
- Context.cs
- ソース:
- 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 インスタンスをホストするサーバーとポートの名前。
null コンテキストの名前がDomainの場合、このコンテキストは、スレッドが実行されているユーザー プリンシパルのドメインのドメイン コントローラーです。
null コンテキストの種類に対して名前がMachineされている場合、これはローカル コンピューター名です。 このパラメーターは、nullコンテキスト型に対してApplicationDirectoryできません。
- container
- String
コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入がこのコンテナーに実行されます。
DomainおよびApplicationDirectoryコンテキスト型の場合、このパラメーターはコンテナー オブジェクトの識別名です。
Machineコンテキスト型の場合、このパラメーターは null に設定する必要があります。
- userName
- String
ストアへの接続に使用するユーザー名。
userNameパラメーターとpassword パラメーターの両方がnullされている場合は、現在のプリンシパルの既定の資格情報が使用されます。 それ以外の場合は、 userName と password の両方が null 以外である必要があり、指定した資格情報がストアへの接続に使用されます。
- password
- String
ストアへの接続に使用するパスワード。
userNameパラメーターとpassword パラメーターの両方がnullされている場合は、現在のプリンシパルの既定の資格情報が使用されます。 それ以外の場合は、 userName と password の両方が null 以外である必要があり、指定した資格情報がストアへの接続に使用されます。
例外
userNameパラメーターとpassword パラメーターは、nullであるか、値を含む必要があります。
Machine パラメーターでcontextType コンテキスト型を指定した場合、コンテナーを指定できません。
name パラメーターでcontainerを指定する場合は、ApplicationDirectoryまたはcontextTypeを指定する必要があります。
contextType パラメーターに有効なContextType列挙値が含まれていません。
注釈
InvalidOperationExceptionは、Domain プリンシパル コンテキストに指定されたコンテナーが有効なコンテナーでない場合に、サーバーに接続する後続のディレクトリ操作呼び出しでスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その可能なInferiors 属性で定義されます。
適用対象
PrincipalContext(ContextType, String, String, ContextOptions, String, String)
- ソース:
- Context.cs
- ソース:
- 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 インスタンスをホストするサーバーとポートの名前。
null コンテキストの名前がDomainの場合、このコンテキストは、スレッドが実行されているユーザー プリンシパルのドメインのドメイン コントローラーです。
null コンテキストの種類に対して名前がMachineされている場合、これはローカル コンピューター名です。 このパラメーターは、nullコンテキスト型に対してApplicationDirectoryできません。
- container
- String
コンテキストのルートとして使用するストア上のコンテナー。 すべてのクエリはこのルートで実行され、すべての挿入がこのコンテナーに実行されます。
DomainおよびApplicationDirectoryコンテキスト型の場合、このパラメーターはコンテナー オブジェクトの識別名です。
Machineコンテキスト型の場合、このパラメーターは null に設定する必要があります。
- options
- ContextOptions
1 つ以上の ContextOptions 列挙値の組み合わせで、サーバーへのバインドに使用されるオプション。 このパラメーターが nullの場合、既定のオプションは ContextOptions.Negotiate |ContextOptions.Signing |ContextOptions.Sealing。
- userName
- String
ストアへの接続に使用するユーザー名。
userNameパラメーターとpassword パラメーターの両方がnullされている場合は、現在のプリンシパルの既定の資格情報が使用されます。 それ以外の場合は、 userName と password の両方が null 以外である必要があり、指定した資格情報がストアへの接続に使用されます。
- password
- String
ストアへの接続に使用するパスワード。
userNameパラメーターとpassword パラメーターの両方がnullされている場合は、現在のプリンシパルの既定の資格情報が使用されます。 それ以外の場合は、 userName と password の両方が null 以外である必要があり、指定した資格情報がストアへの接続に使用されます。
例外
userNameパラメーターとpassword パラメーターは、nullであるか、値を含む必要があります。
Machine パラメーターでcontextType コンテキスト型を指定した場合、コンテナーを指定できません。
ApplicationDirectory パラメーターでcontextTypeを指定するときは、名前またはコンテナーを指定する必要があります。
contextType パラメーターに有効なContextType列挙値が含まれていません。
options パラメーターには、有効なContextOptions列挙値の組み合わせが含まれていません。
注釈
InvalidOperationExceptionは、Domain プリンシパル コンテキストに指定されたコンテナーが有効なコンテナーでない場合に、サーバーに接続する後続のディレクトリ操作呼び出しでスローされる可能性があります。 コンテナーは、スキーマ クラスが、ユーザー、グループ、またはコンピューターのいずれかのプリンシパル クラスを持つオブジェクトとして、その可能なInferiors 属性で定義されます。