UserPrincipal 類別

定義

封裝本身為使用者帳戶的主體。Encapsulates principals that are user accounts.

public ref class UserPrincipal : System::DirectoryServices::AccountManagement::AuthenticablePrincipal
[System.DirectoryServices.AccountManagement.DirectoryRdnPrefix("CN")]
public class UserPrincipal : System.DirectoryServices.AccountManagement.AuthenticablePrincipal
[System.DirectoryServices.AccountManagement.DirectoryRdnPrefix("CN")]
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class UserPrincipal : System.DirectoryServices.AccountManagement.AuthenticablePrincipal
[<System.DirectoryServices.AccountManagement.DirectoryRdnPrefix("CN")>]
type UserPrincipal = class
    inherit AuthenticablePrincipal
[<System.DirectoryServices.AccountManagement.DirectoryRdnPrefix("CN")>]
[<System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)>]
type UserPrincipal = class
    inherit AuthenticablePrincipal
Public Class UserPrincipal
Inherits AuthenticablePrincipal
繼承
屬性

建構函式

UserPrincipal(PrincipalContext)

使用指定的內容來初始化 UserPrincipal 類別的新執行個體。Initializes a new instance of the UserPrincipal class by using the specified context.

UserPrincipal(PrincipalContext, String, String, Boolean)

使用指定的內容、SAM 帳戶名稱、密碼和啟用的值,初始化 UserPrincipal 類別的新執行個體。Initializes a new instance of the UserPrincipal class by using the specified context, SAM account name, password, and enabled value.

屬性

AccountExpirationDate

取得或設定可為 Null 的 DateTime,指定帳戶到期的日期和時間。Gets or sets a Nullable DateTime that specifies the date and time that the account expires.

(繼承來源 AuthenticablePrincipal)
AccountLockoutTime

取得可為 Null 的 DateTime,指定鎖定帳戶的日期和時間。Gets the Nullable DateTime that specifies the date and time that the account was locked out.

(繼承來源 AuthenticablePrincipal)
AdvancedSearchFilter

傳回 AdvancedFilters 物件,先設定唯讀屬性,然後再將物件傳遞至 PrincipalSearcherReturns an AdvancedFilters object to set read-only properties before passing the object to the PrincipalSearcher.

AllowReversiblePasswordEncryption

取得或設定布林值,這個值指定是否針對此帳戶啟用可以復原的密碼加密。Gets or sets a Boolean value that specifies whether reversible password encryption is enabled for this account.

(繼承來源 AuthenticablePrincipal)
BadLogonCount

取得嘗試用不正確的認證登入這個帳戶的次數。Gets the number of logon attempts using incorrect credentials for this account.

(繼承來源 AuthenticablePrincipal)
Certificates

取得 X509Certificate2Collection,其中包含此帳戶的 X509 憑證。Gets a X509Certificate2Collection that contains the X509 certificates for this account.

(繼承來源 AuthenticablePrincipal)
Context

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

(繼承來源 Principal)
ContextRaw

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

(繼承來源 Principal)
ContextType

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

(繼承來源 Principal)
Current

取得使用者主體物件,這個物件表示用於執行執行緒的目前使用者。Gets a user principal object that represents the current user under which the thread is running.

DelegationPermitted

取得或設定可為 Null 的布林值,這個值指定是否可以委派此帳戶。Gets or sets a Nullable Boolean value that specifies whether the account may be delegated.

(繼承來源 AuthenticablePrincipal)
Description

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

(繼承來源 Principal)
DisplayName

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

(繼承來源 Principal)
DistinguishedName

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

(繼承來源 Principal)
EmailAddress

取得或設定這個帳戶的電子郵件地址。Gets or sets the email address for this account.

EmployeeId

取得或設定這個使用者主體的員工 ID。Gets or sets the employee ID for this user principal.

Enabled

取得或設定可為 Null 的布林值,這個值指定是否已針對此帳戶啟用驗證。Gets or sets a Nullable Boolean value that specifies whether this account is enabled for authentication.

(繼承來源 AuthenticablePrincipal)
GivenName

取得或設定使用者主體的名字。Gets or sets the given name for the user principal.

Guid

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

(繼承來源 Principal)
HomeDirectory

取得或設定這個帳戶的主目錄。Gets or sets the home directory for this account.

(繼承來源 AuthenticablePrincipal)
HomeDrive

取得或設定這個帳戶的主磁碟機。Gets or sets the home drive for this account.

(繼承來源 AuthenticablePrincipal)
LastBadPasswordAttempt

取得可為 Null 的 DateTime,指定上次嘗試用錯誤密碼登入這個帳戶的日期和時間。Gets the Nullable DateTime that specifies the date and time of the last incorrect password attempt on this account.

(繼承來源 AuthenticablePrincipal)
LastLogon

取得可為 Null 的 DateTime,指定上次登入這個帳戶的日期和時間。Gets the Nullable DateTime that specifies the date and time of the last logon for this account.

(繼承來源 AuthenticablePrincipal)
LastPasswordSet

取得可為 Null 的 DateTime,指定上次為這個帳戶設定密碼的日期和時間。Gets the Nullable DateTime that specifies the last date and time that the password was set for this account.

(繼承來源 AuthenticablePrincipal)
MiddleName

取得或設定使用者主體的中間名。Gets or sets the middle name for the user principal.

Name

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

(繼承來源 Principal)
PasswordNeverExpires

取得或設定布林值,這個值指定此帳戶的密碼是否會到期。Gets or sets a Boolean value that specifies whether the password expires for this account.

(繼承來源 AuthenticablePrincipal)
PasswordNotRequired

取得或設定布林值,這個值指定此帳戶是否需要密碼。Gets or sets a Boolean value that specifies whether a password is required for this account.

(繼承來源 AuthenticablePrincipal)
PermittedLogonTimes

取得或設定主體可以登入的時間。Gets or sets the times when the principal can logon.

(繼承來源 AuthenticablePrincipal)
PermittedWorkstations

取得允許這個主體登入之工作站的清單。Gets the list of workstations that this principal is permitted to log into.

(繼承來源 AuthenticablePrincipal)
SamAccountName

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

(繼承來源 Principal)
ScriptPath

取得或設定這個帳戶的指令碼路徑。Gets or sets the script path for this account.

(繼承來源 AuthenticablePrincipal)
Sid

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

(繼承來源 Principal)
SmartcardLogonRequired

取得或設定布林值,這個值指定登入帳戶時是否需要智慧卡。Gets or sets a Boolean value that specifies whether a smartcard is required to log on to the account.

(繼承來源 AuthenticablePrincipal)
StructuralObjectClass

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

(繼承來源 Principal)
Surname

取得或設定使用者主體的姓氏。Gets or sets the surname for the user principal.

UserCannotChangePassword

取得或設定布林值,指定使用者是否能夠變更此帳戶的密碼。Gets or sets a Boolean value that specifies whether the user can change the password for this account. 請勿與 ComputerPrincipal 搭配使用。Do not use this with a ComputerPrincipal.

(繼承來源 AuthenticablePrincipal)
UserPrincipalName

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

(繼承來源 Principal)
VoiceTelephoneNumber

取得或設定使用者主體的語音電話號碼。Gets or sets the voice telephone number for the user principal.

方法

ChangePassword(String, String)

將帳戶密碼從舊密碼變更為新密碼。Changes the account password from the old password to the new password. 請勿與 ComputerPrincipal 搭配使用。Do not use this with a ComputerPrincipal.

(繼承來源 AuthenticablePrincipal)
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.

(繼承來源 Principal)
Delete()

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

(繼承來源 Principal)
Dispose()

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

(繼承來源 Principal)
Equals(Object)

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

(繼承來源 Principal)
ExpirePasswordNow()

使這個帳戶的密碼到期。Expires the password for this account. 這會強制使用者在下一次登入時變更密碼。This will force the user to change his/her password at the next logon.

(繼承來源 AuthenticablePrincipal)
ExtensionGet(String)

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

(繼承來源 Principal)
ExtensionSet(String, Object)

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

(繼承來源 Principal)
FindByBadPasswordAttempt(PrincipalContext, DateTime, MatchType)

針對在指定的日期與時間範圍內有記錄不正確的密碼嘗試之使用者傳回 PrincipalSearchResult<T> 物件的集合。Returns a collection of PrincipalSearchResult<T> objects for users that have an incorrect password attempt recorded in the specified date and time range.

FindByExpirationTime(PrincipalContext, DateTime, MatchType)

針對帳戶到期時間在指定的日期和時間範圍內的使用者傳回 PrincipalSearchResult<T> 物件的集合。Returns a collection of PrincipalSearchResult<T> objects for users that have an account expiration time in the specified date and time range.

FindByIdentity(PrincipalContext, IdentityType, String)

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

FindByIdentity(PrincipalContext, String)

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

FindByLockoutTime(PrincipalContext, DateTime, MatchType)

針對帳戶鎖定時間在指定的日期和時間範圍內的使用者傳回 PrincipalSearchResult<T> 物件的集合。Returns a collection of PrincipalSearchResult<T> objects for users that have an account lockout time in the specified date and time range.

FindByLogonTime(PrincipalContext, DateTime, MatchType)

針對在指定的日期和時間範圍有帳戶登入記錄的使用者傳回 PrincipalSearchResult<T> 物件的集合。Returns a collection of PrincipalSearchResult<T> objects for users that have account logon recorded in the specified date and time range.

FindByPasswordSetTime(PrincipalContext, DateTime, MatchType)

針對在指定的日期和時間範圍內設定密碼的使用者傳回 PrincipalSearchResult<T> 物件的集合。Returns a collection of PrincipalSearchResult<T> objects for users that have set their password within the specified date and time range.

GetAuthorizationGroups()

傳回主體物件集合,其中包含所有此使用者為成員的所有授權群組。Returns a collection of principal objects that contains all the authorization groups of which this user is a member. 此函式只會傳回屬於安全性群組的群組,不會傳回通訊群組。This function only returns groups that are security groups; distribution groups are not returned.

GetGroups()

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

(繼承來源 Principal)
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.

(繼承來源 Principal)
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.

(繼承來源 Principal)
GetType()

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

(繼承來源 Object)
GetUnderlyingObject()

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

(繼承來源 Principal)
GetUnderlyingObjectType()

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

(繼承來源 Principal)
IsAccountLockedOut()

傳回布林值,指定帳戶目前是否已鎖定。Returns a Boolean value that specifies whether the account is currently locked out.

(繼承來源 AuthenticablePrincipal)
IsMemberOf(GroupPrincipal)

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

(繼承來源 Principal)
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.

(繼承來源 Principal)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
RefreshExpiredPassword()

重新整理到期的密碼。Refreshes an expired password.

(繼承來源 AuthenticablePrincipal)
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.

(繼承來源 Principal)
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.

(繼承來源 Principal)
SetPassword(String)

將帳戶密碼設定為指定的值。Sets the account password to the specified value.

(繼承來源 AuthenticablePrincipal)
ToString()

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

(繼承來源 Principal)
UnlockAccount()

如果帳戶目前遭鎖定,則解除鎖定。Unlocks the account if it is currently locked out.

(繼承來源 AuthenticablePrincipal)

適用於