Export (0) Print
Expand All

Principal Class

Encapsulates the account data and operations common to all security principals. This is the abstract base class from which all security principals are derived.

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

[<AbstractClass>]
[<DirectoryServicesPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)>]
[<DirectoryServicesPermissionAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)>]
type Principal =  
    class 
        interface IDisposable 
    end

The Principal type exposes the following members.

  NameDescription
Protected methodPrincipalInitializes a new instance of the Principal class. This constructor is called by derived-class constructors to initialize the base class and is not intended to be called directly from your code.
Top

  NameDescription
Public propertyContextGets a principal context that is associated with the principal.
Protected propertyContextRawGets a principal context that is associated with this principal.
Public propertyContextTypeGets the context type enumeraton value that specifies the type of principal context associated with this principal.
Public propertyDescriptionGets or sets the description of the principal.
Public propertyDisplayNameGets or sets the display name for this principal.
Public propertyDistinguishedNameGets the distinguished name (DN) for this principal.
Public propertyGuidGets the GUID associated with this principal.
Public propertyNameGets or sets the name of this principal.
Public propertySamAccountNameGets or sets the SAM account name for this principal.
Public propertySidGets the Security ID (SID) of the principal.
Public propertyStructuralObjectClassGets the structural object class directory attribute.
Public propertyUserPrincipalNameGets or sets the user principal name (UPN) associated with this principal.
Top

  NameDescription
Protected methodCheckDisposedOrDeletedDetermines whether the Dispose or Delete methods have been called on this class. This method is called by classes that derive from this principal class.
Public methodDeleteDeletes the principal object from the store.
Public methodDisposeDisposes the current instance of the Principal object.
Public methodEqualsReturns a Boolean value that specifies whether the supplied object is equal to the current object. (Overrides Object.Equals(Object).)
Protected methodExtensionGetRetrieves an attribute of an extended class object.
Protected methodExtensionSetSets the value of an attribute in an extended class.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberFindByIdentity(PrincipalContext, String)Returns a principal object that matches the specified identity value.
Public methodStatic memberFindByIdentity(PrincipalContext, IdentityType, String)Returns a principal object that matches the specified identity type, and value. This version of the FindByIdentity method determines the format of the identity value.
Protected methodStatic memberFindByIdentityWithType(PrincipalContext, Type, String)Returns a principal object that matches the specified identity type, and value. This method is called by the implementation of the derived-class FindByIdentity method to restrict the search to the derived class type and is not intended to be called directly from your code.
Protected methodStatic memberFindByIdentityWithType(PrincipalContext, Type, IdentityType, String)Returns a principal object that matches the specified identity type, and value. This method is called by the implementation of the derived-class FindByIdentity method to restrict the search to the derived class type and is not intended to be called directly from your code.
Public methodGetGroups()Returns a collection of group objects that specify the groups of which the current principal is a member.
Public methodGetGroups(PrincipalContext)Returns a collection of group objects that the principal is a member of and that exist in the store provided by the specified context parameter.
Public methodGetHashCodeRetrieves the hash created from the contents of the principal object, suited for use in hashing algorithms and data structures like a hash table. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetUnderlyingObjectReturns the underlying DirectoryEntry object that provides the contact data for the principal object.
Public methodGetUnderlyingObjectTypeReturns the underlying object type.
Public methodIsMemberOf(GroupPrincipal)Returns a Boolean value that specifies whether the principal is a member of the specified group.
Public methodIsMemberOf(PrincipalContext, IdentityType, String)Returns a Boolean value that specifies whether the principal is a member of the group specified by identity type and value.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSave()Saves the changes that were made on the principal object to the store. If this is a new principal object, this method inserts it into the store.
Public methodSave(PrincipalContext)Saves the changes that were made on the principal object to the store. If this is a new principal object, this method inserts it into the specified context. If the principal has already been persisted, it is moved from the original context to the specified context.
Public methodToStringReturns a user friendly string representation of the current principal object. (Overrides Object.ToString().)
Top

Custom extension classes that derive from this class can call this constructor from the derived class constructor to initialize the base class. For more information, see the Principal Extensions overview topic.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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