Back to Devexpress

TdxAuthorizationAgentUserInfo.DisplayName Property

vcl-dxauthorizationagents-dot-tdxauthorizationagentuserinfo-665dcafd.md

latest2.7 KB
Original Source

TdxAuthorizationAgentUserInfo.DisplayName Property

Returns the display name of the connected account’s owner.

Declaration

delphi
property DisplayName: string read;

Property Value

TypeDescription
string

The user display name.

This property returns an empty string if the user information provider is not connected to a supported online account.

|

Remarks

Use DisplayName and Mail properties to obtain the user display name and e-mail from a connected online account. Call the UpdateInfo procedure to connect the user information provider to an online account through the parent authorization agent and load user information.

Code Example: Obtain User Information from a Microsoft Account

The following code example creates a user information provider and uses a configured TdxMicrosoftGraphAPIOAuth2AuthorizationAgent component to display user information from an online account in the form caption:

delphi
var
  AInfo: TdxAuthorizationAgentUserInfo;
begin
  AInfo := TdxAuthorizationAgentUserInfo.GetUserInfo(dxMicrosoftGraphAPIOAuth2AuthorizationAgent1);
  if AInfo = nil then Exit;
  try
    AInfo.UpdateInfo; // Obtains user information through the authorization agent component
    Caption := Caption + Format(' User Name: %s; e-mail: %s', [AInfo.DisplayName, AInfo.Mail]);
  finally
    AInfo.Free; // Releases the user information provider to avoid memory leaks
  end;
end;
cpp
TdxAuthorizationAgentUserInfo* AInfo;
  AInfo = TdxAuthorizationAgentUserInfo::GetUserInfo(dxMicrosoftGraphAPIOAuth2AuthorizationAgent1);
  if(AInfo == nullptr) { return; }
  try
  {
    AInfo->UpdateInfo(); // Obtains user information through the authorization agent component
    Caption = Caption + " User Name: ";
    Caption = Caption + AInfo->DisplayName;
    Caption = Caption + "; e-mail: ";
    Caption = Caption + AInfo->Mail;
  }
  __finally
  {
    delete AInfo; // Releases the user information provider to avoid memory leaks
  }

See Also

TdxAuthorizationAgentUserInfo Class

TdxAuthorizationAgentUserInfo Members

dxAuthorizationAgents Unit