Table of Contents

Getting started with TMS FNC Cloud Google Calendar

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Cloud Pack installed.
  • A Google account and an OAuth 2.0 client (client ID and secret) created in the Google Cloud console with the Google Calendar API enabled.

Add the component

  1. Drop TTMSFNCCloudGoogleCalendar onto a form or create it in code.
  2. Set the OAuth credentials (Authentication.ClientID, Authentication.Secret, Authentication.CallBackURL, Authentication.CallBackPort).
  3. Persist tokens and call Connect; once OnConnected fires, call GetCalendars.

The minimal connect sequence — credentials, token persistence, and an OnConnected handler that loads the calendars:

procedure TForm1.SetupCalendar;
begin
  FCalendar := TTMSFNCCloudGoogleCalendar.Create(Self);

  // OAuth 2.0 client credentials from the Google Cloud console (Calendar API enabled).
  FCalendar.Authentication.ClientID := '<your-client-id>.apps.googleusercontent.com';
  FCalendar.Authentication.Secret := '<your-client-secret>';
  FCalendar.Authentication.CallBackURL := 'http://127.0.0.1:8000';
  FCalendar.Authentication.CallBackPort := 8000;

  // Persist tokens so the consent screen only appears on first run.
  FCalendar.PersistTokens.Location := plIniFile;
  FCalendar.PersistTokens.Key := TTMSFNCUtils.AddBackslash(TTMSFNCUtils.GetDocumentsPath)
    + FCalendar.ClassName + '.ini';
  FCalendar.LoadTokens;

  FCalendar.OnConnected := CalendarConnected;
  FCalendar.Connect; // opens the browser for consent on first run, then fires OnConnected
end;

procedure TForm1.CalendarConnected(Sender: TObject);
begin
  // Tokens are valid here - safe to query calendars and events.
  FCalendar.GetCalendars;
end;

Next steps

  • Guides — authentication, managing calendars, and managing events.
  • API reference — full class reference.