Back to Devexpress

TdxMicrosoftGraphAPIOAuth2AuthorizationAgentUserInfo Class

vcl-dxauthorizationagents-dot-tdxmicrosoftgraphapioauth2authorizationagentuserinfo.md

latest5.3 KB
Original Source

TdxMicrosoftGraphAPIOAuth2AuthorizationAgentUserInfo Class

A data provider designed to load user information from a connected Microsoft online account.

Declaration

delphi
TdxMicrosoftGraphAPIOAuth2AuthorizationAgentUserInfo = class(
    TdxOAuth2AuthorizationAgentUserInfo
)

Remarks

The Microsoft user information provider can obtain general account information (such as user name or e-mail) from a Microsoft account.

Main API Members

The list below outlines key members of the TdxMicrosoftGraphAPIOAuth2AuthorizationAgentUserInfo class. These members allow you to obtain user information from a Microsoft account.

Online Service Interaction APIs

AuthorizationAgentProvides access to the parent authorization agent component.GetUserInfoCreates a new user information provider for the target Microsoft authorization agent component.UpdateInfoConnects to a Microsoft account through the parent authorization agent and loads user information.

User Information APIs

DisplayNameReturns the display name of the connected account’s owner.MailReturns the e-mail of the connected account’s owner.

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
  }

Other Online Service Data Providers

User information providers allow you to retrieve only basic user information from a compatible online service account. The sections below list dedicated online service data provider classes that allow you to synchronize data between an online account and your desktop VCL application.

Cloud Storage Provider Classes

You can use the following data providers to synchronize data between the TdxCloudStorage component and a cloud storage account.

TdxCloudStorageGoogleDriveProviderAn online file provider that can work with the Google Drive file storage service.TdxCloudStorageMicrosoftOneDriveProviderAn online file data provider that can work with Microsoft OneDrive®.

Online Calendar Provider Classes

You can use the following data providers to synchronize events between the TcxScheduler control and an online calendar.

TcxSchedulerWebServiceStorageGoogleProviderAn online event data provider that can work with Google accounts.TcxSchedulerWebServiceStorageOfficeProviderAn online event data provider that can work with Microsoft accounts.

Inheritance

TObject TcxIUnknownObject TdxAuthorizationAgentUserInfo TdxOAuth2AuthorizationAgentUserInfo TdxMicrosoftGraphAPIOAuth2AuthorizationAgentUserInfo

See Also

TdxGoogleAPIOAuth2AuthorizationAgentUserInfo Class

TdxMicrosoftGraphAPIOAuth2AuthorizationAgentUserInfo Members

dxAuthorizationAgents Unit