Skip to main content

TdxAuthorizationAgentUserInfo.UpdateInfo Method

Connects the provider to an online account and loads user information.

Declaration

procedure UpdateInfo;

Remarks

Call the UpdateInfo procedure to attempt to connect the user information provider in an online account through the parent authorization agent settings. If the attempt is successful, the UpdateInfo procedure updates Mail and DisplayName property values.

Note

If an authentication or authorization error occurs, an UpdateInfo procedure call has no effect. You can handle the AuthorizationAgent.OnError event to obtain information on possible errors.

Code Example

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