PrincipalContext Class

 

Encapsulates the server or domain against which all operations are performed, the container that is used as the base of those operations, and the credentials used to perform the operations.

Namespace:   System.DirectoryServices.AccountManagement
Assembly:  System.DirectoryServices.AccountManagement (in System.DirectoryServices.AccountManagement.dll)

System.Object
  System.DirectoryServices.AccountManagement.PrincipalContext

[SecurityCriticalAttribute(SecurityCriticalScope.Everything)]
[SecurityPermissionAttribute(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]
[DirectoryServicesPermissionAttribute(SecurityAction.LinkDemand, 
	Unrestricted = true)]
[DirectoryServicesPermissionAttribute(SecurityAction.InheritanceDemand, 
	Unrestricted = true)]
public class PrincipalContext : IDisposable

NameDescription
System_CAPS_pubmethodPrincipalContext(ContextType)

Initializes a new instance of the PrincipalContext class with the specified context type.

System_CAPS_pubmethodPrincipalContext(ContextType, String)

Initializes a new instance of the PrincipalContext class with the specified context type and name.

System_CAPS_pubmethodPrincipalContext(ContextType, String, String)

Initializes a new instance of the PrincipalContext class with the specified context type, name, and container.

System_CAPS_pubmethodPrincipalContext(ContextType, String, String, ContextOptions)

Initializes a new instance of the PrincipalContext class with the specified context type, name, container, and context options.

System_CAPS_pubmethodPrincipalContext(ContextType, String, String, ContextOptions, String, String)

Initializes a new instance of the PrincipalContext class with the specified context type, name, container, context options, username, and password.

System_CAPS_pubmethodPrincipalContext(ContextType, String, String, String)

Initializes a new instance of the PrincipalContext class with the specified context type, name, username, and password.

System_CAPS_pubmethodPrincipalContext(ContextType, String, String, String, String)

Initializes a new instance of the PrincipalContext class with the specified context type, name, container, username, and password.

NameDescription
System_CAPS_pubpropertyConnectedServer

Gets the name of the server to which the principal context is connected.

System_CAPS_pubpropertyContainer

Gets the value specified in the container parameter in the constructor.

System_CAPS_pubpropertyContextType

Gets the context type that specifies the type of store for the principal context.

System_CAPS_pubpropertyName

Gets the value specified as the name parameter in the constructor.

System_CAPS_pubpropertyOptions

Gets the options specified in the contextOptions parameter of the constructor.

System_CAPS_pubpropertyUserName

Gets the value specified in the username parameter in the constructor.

NameDescription
System_CAPS_pubmethodDispose()

Disposes the current instance of the T:System.DirectorySerices.AccountManagement.PrincipalContext object.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodValidateCredentials(String, String)

Creates the connections to the server and returns a Boolean value that specifies whether the specified username and password are valid.

System_CAPS_pubmethodValidateCredentials(String, String, ContextOptions)

Creates the connections to the server and returns a Boolean value that specifies whether the specified user name and password are valid. This method performs fast credential validation of the username and password.

For search operations, the principal context defines the search base, and for insert operations the context defines the container into which the object is inserted.

.NET Framework
Available since 3.5

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

System.DirectoryServices.AccountManagement
System.DirectoryServices.AccountManagement Namespace Overview

Return to top
Show: