共用方式為


WindowsAccountType 列舉

定義

指定所使用的 Windows 帳戶類型。

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

欄位

Anonymous 3

匿名帳戶。

Guest 1

Windows 來賓帳戶。

Normal 0

標準使用者帳戶。

System 2

Windows 系統帳戶。

範例

下列範例示範如何使用 WindowsIdentity 建構函式,為指定的 Windows 帳戶令牌、指定的驗證類型和指定的 Windows 帳戶類型所代表的使用者建立 類別的新實例 WindowsIdentity 。 此程式代碼範例是提供給 類別之較大範例的 WindowsIdentity 一部分。

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 類別所使用。

適用於