ICredentialProviderUser::GetStringValue method (credentialprovider.h)

Retrieves string properties from the ICredentialProviderUser object based on the input value.


HRESULT GetStringValue(
  [out] LPWSTR         *stringValue


[in] key

One of the following values that specify the property to retrieve.

REFPROPERTYKEY Description Applies to...
PKEY_Identity_DisplayName The friendly user name. Logon UI and Credential UI
PKEY_Identity_LogonStatusString A localized string that indicates the user's logged on status. Logon UI only
PKEY_Identity_PrimarySid The user's SID. Logon UI and Credential UI
PKEY_Identity_ProviderID The user's provider ID. Logon UI and Credential UI
PKEY_Identity_QualifiedUserName The name used to pack an authentication buffer. Logon UI and Credential UI
PKEY_Identity_UserName The user name. Logon UI and Credential UI

[out] stringValue

The address of a pointer to a buffer that, when this method returns successfully, receives the requested string.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


Each of these values can also be retrieved as a PROPVARIANT through ICredentialProviderUser::GetValue.

Consider a scenario with the following users.

  • Domain user:
    • Domain: contoso
    • User name: lisa
    • Friendly name: Lisa Andrews
  • Local user:
    • PC name: lisa-pc
    • User name: lisa
    • Friendly name: Lisa Andrews
  • Microsoft account:
    • Email address: lisa@contoso.com
    • Friendly name: Lisa Andrews
In this scenario, the following table provides some sample data for each of the key values.
REFPROPERTYKEY Domain user Local user Microsoft account
PKEY_Identity_DisplayName "Lisa Andrews" "Lisa Andrews" "Lisa Andrews"
PKEY_Identity_LogonStatusString "Signed-in" "Locked" "Remotely signed in from lisa-pc"
PKEY_Identity_PrimarySid "{S-1-5-21-2279990834-2601404236-735077814-1001}" "{S-1-5-21-2279990834-2601404236-735077814-1001}" "{S-1-5-21-2279990834-2601404236-735077814-1001}"
PKEY_Identity_ProviderID "{A198529B-730F-4089-B646-A12557F5665E}" "{A198529B-730F-4089-B646-A12557F5665E}" Not pre-defined
PKEY_Identity_QualifiedUserName "contoso\lisa" "lisa-pc\lisa" "<account provider name>\lisa@contoso.com"
PKEY_Identity_UserName "contoso\lisa" "lisa" "lisa@contoso.com"


Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header credentialprovider.h
Library CredentialProvider.lib
DLL Authui.dll

See also