Skip to main content
Table of Contents

Getting started with TMS FNC Cloud Microsoft Outlook Mail

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Cloud Pack installed.
  • An app registered in the Microsoft Entra admin center with a client ID, client secret, and a registered redirect URI, with Mail permissions granted.

Add the component

  1. Drop TTMSFNCCloudMicrosoftOutlookMail onto a form (or create it in code).
  2. Set the app credentials on Authentication (client ID, secret, redirect URI).
  3. Call Connect to authenticate, then call mail operations from OnConnected.

Minimal example

Set the credentials, connect, and list the mail folders once connected:

Connect to Microsoft Outlook Mail with OAuthPascalC++
procedure TForm1.FormCreate(Sender: TObject);
begin
  // Credentials from your app registration (https://portal.azure.com).
  TMSFNCCloudMicrosoftOutlookMail1.Authentication.ClientID := 'your-client-id';
  TMSFNCCloudMicrosoftOutlookMail1.Authentication.Secret := 'your-client-secret';
  // Must match a redirect URI registered on the app.
  TMSFNCCloudMicrosoftOutlookMail1.Authentication.CallBackURL := 'http://127.0.0.1:8000';

  TMSFNCCloudMicrosoftOutlookMail1.OnConnected := OutlookMailConnected;
  // Opens the Microsoft consent page in the browser and exchanges the code for tokens.
  TMSFNCCloudMicrosoftOutlookMail1.Connect;
end;

procedure TForm1.OutlookMailConnected(Sender: TObject);
begin
  TMSFNCCloudMicrosoftOutlookMail1.GetFolders;
end;
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  // Credentials from your app registration (https://portal.azure.com).
  TMSFNCCloudMicrosoftOutlookMail1->Authentication->ClientID = "your-client-id";
  TMSFNCCloudMicrosoftOutlookMail1->Authentication->Secret = "your-client-secret";
  // Must match a redirect URI registered on the app.
  TMSFNCCloudMicrosoftOutlookMail1->Authentication->CallBackURL = "http://127.0.0.1:8000";

  TMSFNCCloudMicrosoftOutlookMail1->OnConnected = OutlookMailConnected;
  // Opens the Microsoft consent page in the browser and exchanges the code for tokens.
  TMSFNCCloudMicrosoftOutlookMail1->Connect();
}

void __fastcall TForm1::OutlookMailConnected(TObject *Sender)
{
  TMSFNCCloudMicrosoftOutlookMail1->GetFolders();
}

Next steps