Share via


UserInformation.GetPrincipalNameAsync メソッド

定義

ユーザーのプリンシパル名を取得します。 この名前はユーザー プリンシパル名です (通常はユーザーのアドレスですが、これは常に正しいとは限りません)。

重要

UserInformation クラスは、Windows 10以降ではサポートされていません。 代わりに User クラスを使用してください。 UserInformation クラスのドキュメントの「解説」を参照してください。

public:
 static IAsyncOperation<Platform::String ^> ^ GetPrincipalNameAsync();
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<winrt::hstring> GetPrincipalNameAsync();
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Deprecated("Use User instead of UserInformation. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.System.UserProfile.UserProfileContract")]
 static IAsyncOperation<winrt::hstring> GetPrincipalNameAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<string> GetPrincipalNameAsync();
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Deprecated("Use User instead of UserInformation. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.System.UserProfile.UserProfileContract")]
public static IAsyncOperation<string> GetPrincipalNameAsync();
function getPrincipalNameAsync()
Public Shared Function GetPrincipalNameAsync () As IAsyncOperation(Of String)

戻り値

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

ユーザーのプリンシパル名。

属性

注釈

重要

UserInformation クラスは、Windows 10以降ではサポートされていません。 代わりに User クラスを使用してください。 UserInformation クラスのドキュメントの「解説」を参照してください。

プリンシパル名を持つのはドメイン ユーザーだけです。 プリンシパル名へのアクセスは、プライバシー設定でブロックできます ( UserInformation.NameAccessAllowed プロパティが false の場合など)。 アクセスがブロックされている場合、このメソッドは空の文字列を返します。

この方法では、 enterpriseAuthentication 機能が必要です。

このメソッドは例外をスローしません。

適用対象

こちらもご覧ください