Principal Principal Principal 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.

public ref class Principal abstract : IDisposable
public abstract class Principal : IDisposable
type Principal = class
    interface IDisposable
Public MustInherit Class Principal
Implements IDisposable
繼承
PrincipalPrincipalPrincipalPrincipal
衍生
實作

備註

衍生自這個類別的自訂延伸模組類別可以呼叫這個建構函式,從衍生的類別建構函式來初始化基底類別。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.

建構函式

Principal() Principal() Principal() Principal()

初始化 Principal 類別的新執行個體。Initializes 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.

屬性

Context Context Context Context

取得與主體關聯的主體內容。Gets a principal context that is associated with the principal.

ContextRaw ContextRaw ContextRaw ContextRaw

取得與這個主體關聯的主體內容。Gets a principal context that is associated with this principal.

ContextType ContextType ContextType ContextType

取得內容類型列舉值,這個值指定與這個主體建立關聯的主體內容類型。Gets the context type enumeration value that specifies the type of principal context associated with this principal.

Description Description Description Description

取得或設定主體的描述。Gets or sets the description of the principal.

DisplayName DisplayName DisplayName DisplayName

取得或設定這個主體的顯示名稱。Gets or sets the display name for this principal.

DistinguishedName DistinguishedName DistinguishedName DistinguishedName

取得這個主體的辨別名稱 (DN)。Gets the distinguished name (DN) for this principal.

Guid Guid Guid Guid

取得與這個主體關聯的 GUID。Gets the GUID associated with this principal.

Name Name Name Name

取得或設定這個主體的名稱。Gets or sets the name of this principal.

SamAccountName SamAccountName SamAccountName SamAccountName

取得或設定這個主體的 SAM 帳戶名稱。Gets or sets the SAM account name for this principal.

Sid Sid Sid Sid

取得主體的安全識別項 (SID)。Gets the Security ID (SID) of the principal.

StructuralObjectClass StructuralObjectClass StructuralObjectClass StructuralObjectClass

取得結構性物件類別目錄屬性。Gets the structural object class directory attribute.

UserPrincipalName UserPrincipalName UserPrincipalName UserPrincipalName

取得或設定與此主體相關聯的使用者主體名稱 (UPN)。Gets or sets the user principal name (UPN) associated with this principal.

方法

CheckDisposedOrDeleted() CheckDisposedOrDeleted() CheckDisposedOrDeleted() CheckDisposedOrDeleted()

判斷是否已在這個類別上呼叫 Dispose()Delete() 方法。Determines whether the Dispose() or Delete() methods have been called on this class. 這個方法是由衍生自此主體類別的類別呼叫。This method is called by classes that derive from this principal class.

Delete() Delete() Delete() Delete()

從存放區刪除主體物件。Deletes the principal object from the store.

Dispose() Dispose() Dispose() Dispose()

處置 Principal 物件目前的執行個體。Disposes the current instance of the Principal object.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

傳回布林值,這個值指定提供的物件是否等於目前的物件。Returns a Boolean value that specifies whether the supplied object is equal to the current object.

ExtensionGet(String) ExtensionGet(String) ExtensionGet(String) ExtensionGet(String)

擷取擴充類別物件的屬性。Retrieves an attribute of an extended class object.

ExtensionSet(String, Object) ExtensionSet(String, Object) ExtensionSet(String, Object) ExtensionSet(String, Object)

在擴充類別中設定屬性 (Attribute) 的值。Sets the value of an attribute in an extended class.

FindByIdentity(PrincipalContext, IdentityType, String) FindByIdentity(PrincipalContext, IdentityType, String) FindByIdentity(PrincipalContext, IdentityType, String) FindByIdentity(PrincipalContext, IdentityType, String)

傳回符合指定的識別類型和值的主體物件。Returns a principal object that matches the specified identity type, and value. 這一版的 FindByIdentity(PrincipalContext, IdentityType, String) 方法會判斷身分識別值的格式。This version of the FindByIdentity(PrincipalContext, IdentityType, String) method determines the format of the identity value.

FindByIdentity(PrincipalContext, String) FindByIdentity(PrincipalContext, String) FindByIdentity(PrincipalContext, String) FindByIdentity(PrincipalContext, String)

傳回符合指定的識別值之主體物件。Returns a principal object that matches the specified identity value.

FindByIdentityWithType(PrincipalContext, Type, IdentityType, String) FindByIdentityWithType(PrincipalContext, Type, IdentityType, String) FindByIdentityWithType(PrincipalContext, Type, IdentityType, String) FindByIdentityWithType(PrincipalContext, Type, IdentityType, String)

傳回符合指定的識別類型和值的主體物件。Returns a principal object that matches the specified identity type, and value. 這個方法會由衍生類別 FindByIdentity 方法的實作來呼叫,以將搜尋限制為衍生類別類型,而且不適合從您的程式碼中直接呼叫。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.

FindByIdentityWithType(PrincipalContext, Type, String) FindByIdentityWithType(PrincipalContext, Type, String) FindByIdentityWithType(PrincipalContext, Type, String) FindByIdentityWithType(PrincipalContext, Type, String)

傳回符合指定的識別類型和值的主體物件。Returns a principal object that matches the specified identity type, and value. 這個方法會由衍生類別 FindByIdentity 方法的實作來呼叫,以將搜尋限制為衍生類別類型,而且不適合從您的程式碼中直接呼叫。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.

GetGroups() GetGroups() GetGroups() GetGroups()

傳回群組物件的集合,指定目前的主體是哪些群組的成員。Returns a collection of group objects that specify the groups of which the current principal is a member.

GetGroups(PrincipalContext) GetGroups(PrincipalContext) GetGroups(PrincipalContext) GetGroups(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.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

從主體物件的內容擷取建立的雜湊,適用於雜湊演算法和像是雜湊資料表的結構。Retrieves the hash created from the contents of the principal object, suited for use in hashing algorithms and data structures like a hash table.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
GetUnderlyingObject() GetUnderlyingObject() GetUnderlyingObject() GetUnderlyingObject()

傳回能為主體物件提供連絡資料的基礎 DirectoryEntry 物件。Returns the underlying DirectoryEntry object that provides the contact data for the principal object.

GetUnderlyingObjectType() GetUnderlyingObjectType() GetUnderlyingObjectType() GetUnderlyingObjectType()

傳回基礎物件型別。Returns the underlying object type.

IsMemberOf(GroupPrincipal) IsMemberOf(GroupPrincipal) IsMemberOf(GroupPrincipal) IsMemberOf(GroupPrincipal)

傳回布林值,這個值指定主體是否為所指定群組的成員。Returns a Boolean value that specifies whether the principal is a member of the specified group.

IsMemberOf(PrincipalContext, IdentityType, String) IsMemberOf(PrincipalContext, IdentityType, String) IsMemberOf(PrincipalContext, IdentityType, String) IsMemberOf(PrincipalContext, IdentityType, String)

傳回布林值,這個值指定主體是否為識別型別和值所指定之群組的成員。Returns a Boolean value that specifies whether the principal is a member of the group specified by identity type and value.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
Save() Save() Save() Save()

將在主體物件上所做的變更儲存至存放區。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.

Save(PrincipalContext) Save(PrincipalContext) Save(PrincipalContext) Save(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.

ToString() ToString() ToString() ToString()

傳回目前主體物件的使用者易記字串表示。Returns a user friendly string representation of the current principal object.

適用於