Skip to main content

TdxAuthorizationAgentUserInfo.DisplayName Property

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

Declaration

property DisplayName: string read;

Property Value

Type Description
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:

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;
See Also