WindowsAccountType 列舉

定義

指定所使用的 Windows 帳戶類型。Specifies the type of Windows account used.

public enum class WindowsAccountType
[System.Runtime.InteropServices.ComVisible(true)]
public enum WindowsAccountType
public enum WindowsAccountType
[System.Serializable]
public enum WindowsAccountType
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum WindowsAccountType
type WindowsAccountType = 
Public Enum WindowsAccountType
繼承
WindowsAccountType
屬性

欄位

Anonymous 3

匿名帳戶。An anonymous account.

Guest 1

Windows 來賓帳戶。A Windows guest account.

Normal 0

標準使用者帳戶。A standard user account.

System 2

Windows 系統帳戶。A Windows system account.

範例

下列範例示範如何使用 WindowsIdentity 的函式,為指定的 Windows 帳戶標記、指定的驗證類型和指定的 Windows 帳戶類型所代表的使用者,建立 WindowsIdentity 類別的新實例。The following example shows how to use the WindowsIdentity constructor to create a new instance of the WindowsIdentity class for the user represented by the specified Windows account token, the specified authentication type, and the specified Windows account type. 這個程式碼範例是針對 WindowsIdentity 類別所提供的較大範例的一部分。This code example is part of a larger example provided for the WindowsIdentity class.

void IntPtrStringTypeConstructor( IntPtr logonToken )
{
   
   // Construct a WindowsIdentity object using the input account token,
   // and the specified authentication type and Windows account type.
   String^ authenticationType = "WindowsAuthentication";
   WindowsAccountType guestAccount = WindowsAccountType::Guest;
   WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType,guestAccount );
   
   Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name );
}
private static void IntPtrStringTypeConstructor(IntPtr logonToken)
{
    // Construct a WindowsIdentity object using the input account token,
    // and the specified authentication type, and Windows account type.
    string authenticationType = "WindowsAuthentication";
    WindowsAccountType guestAccount = WindowsAccountType.Guest;
    WindowsIdentity windowsIdentity =
        new WindowsIdentity(logonToken, authenticationType, guestAccount);

    Console.WriteLine("Created a Windows identity object named " +
        windowsIdentity.Name + ".");
}
Private Sub IntPtrStringTypeConstructor(ByVal logonToken As IntPtr)
    ' Construct a WindowsIdentity object using the input account token,
    ' and the specified authentication type and Windows account type.
    Dim authenticationType As String = "WindowsAuthentication"
    Dim guestAccount As WindowsAccountType = WindowsAccountType.Guest
    Dim windowsIdentity As _
        New WindowsIdentity(logonToken, authenticationType, guestAccount)

    WriteLine("Created a Windows identity object named " + _
        windowsIdentity.Name + ".")
End Sub

備註

WindowsAccountType 列舉型別是由 WindowsIdentity 類別所使用。The WindowsAccountType enumeration is used by the WindowsIdentity class.

適用於