> For the complete documentation index, see [llms.txt](https://knowledgebase.fabricdata.com/xytech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.fabricdata.com/xytech/calendar-integration-setup/calendar-integration-setup-of-master-calendar-on-ms-azure-or-google-deprecated.md). Agents can also search and read this documentation through its [MCP server](https://knowledgebase.fabricdata.com/xytech/~gitbook/mcp).

# Calendar Integration setup of master calendar on MS Azure or Google (deprecated)

This document describes the configuration steps for either Microsoft Azure or Google Workspace. (release 11.3 - 26.5)

### Summary Integration Setup Steps:

* Create calendar platform credentials for Xytech.
* Create a master calendar account on your calendar platform.
* Configure Xytech MPSE service with the calendar integration configuration (for self-hosted sites. For Xytech hosted sites provide Technical Services with the credentials to configure).

### Microsoft Graph app registration and master calendar

#### Create app registration in Azure

Obtain the following parameter values:

* Tennent ID
* Application ID (client ID)
* Secret
* Master calendar account email

{% hint style="info" %}
***Example Azure parameters required for Xytech***

**Application ID (client ID)**: 8003b4d8-0b09-4eb7-9daf-9d26d27806ed \
**Secret**: MdC8Q\~IIgzXNaeD-7\_0nvp3F4d3uu.AVNRclLame \
**Tennent**: 94fb7681-12345-6789-a3cb-ddc177452a36 \
**Master calendar account**: <xytechBookings@example.com>
{% endhint %}

#### Steps using Microsoft Entra ID

1. Manage - App Registrations - New Registration

<div align="left"><figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2FFyZs39sQo7S4ihxaACQO%2Fimage.png?alt=media&amp;token=7f5632f9-8984-44f2-b4ea-a37738dd19b6" alt="" width="563"><figcaption></figcaption></figure></div>

2. Name the application e.g. Xytech Calendar Integration. (no redirect URI required)
3. Certificates & Secrets - create a Client Secret and make a note of it. (note the expiry date for when it needs regenerating)&#x20;

<figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2F7aHPaUXR73hEM07LHheo%2Fimage.png?alt=media&amp;token=579924da-ed3f-4c20-b6ba-f616acce443e" alt=""><figcaption></figcaption></figure>

4. API Permissions - add the following permissions for Microsoft Graph

* Calendars.Read
* Calendars.ReadWrite&#x20;

<figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2Fz33xHroqSlTr3mKqAguT%2Fimage.png?alt=media&amp;token=a0890e61-fab9-4cb7-885f-fdba4889ea08" alt=""><figcaption></figcaption></figure>

5. Expose API - Create a scope&#x20;

<figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2F7EZRzgZvws3QXqeMur7M%2Fimage.png?alt=media&amp;token=f11ff492-a393-45d0-9d3c-2f24bd7deab0" alt=""><figcaption></figcaption></figure>

6. On the overview display, also make a note of the Application (Client ID), Tennent ID
7. Create a user account to act as the master calendar and note the email address

### Google Calendar service account and master calendar

#### Google Service Account

This integration is intended for use with a Google Workspace account used by a business to provide calendar services to multiple individuals, not a Gmail account used by a single individual.

{% hint style="info" %}
***Example Google parameters required for Xytech***

**Service Account Email**: <xytech-services@xytech-int-00.iam.gserviceaccount.com> \
**Impersonation Email**: <xytechBookings@example.com> \
**Certificate file**: xytech-integrations-000000-9d4b9b0bae83.p12 \
**Secret**: notasecret
{% endhint %}

1. Create and configure a new Google Service Account via the Google Console at: <https://console.cloud.google.com/> Go to API & Services\Credentials and add a new Service Account.
   * Note the email of the Service Account.
   * Note the Service Account Unique ID.
2. Create a P12 key and password.
   * Download the P12 certificate file and note the file name
   * Note the password.

<figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2FJD4V2xjTO2SO0rVblvBE%2Fimage.png?alt=media&amp;token=6ba85f0d-e4b2-4ec0-9490-c5ed88fa0201" alt=""><figcaption></figcaption></figure>

3. Enable Google Calendar API (APIs and Services\Enabled APIs and services)&#x20;

<div align="left"><figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2Fpz887BkjyiiXeMVmOFkj%2Fimage.png?alt=media&amp;token=70e51c4e-779e-4d33-bef9-36b2468334cd" alt="" width="446"><figcaption></figcaption></figure></div>

4. Enable Google Workspace Domain-wide Delegation by entering the service account’s Unique ID as the Client ID, at: <https://admin.google.com/ac/owl> (Security\Access and Data Controls\Api Controls\Domain Wide Delegation) Allow the following scopes:

```
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.events
```

### Xytech configuration (for self-hosting customers)

#### Pre-reqs

Xytech App server config should be properly configured including: queue parameters for each database. e.g.&#x20;

<div align="left"><figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2F9MwLNHvBydRSTuByCZHx%2Fimage.png?alt=media&amp;token=72bda37a-fb50-4efd-bc3c-ded2ba7b940e" alt="" width="563"><figcaption></figcaption></figure></div>

#### Create private queues for calendar integration (MSMQ)

* XytechCalendar
* XytechCalendarStatus&#x20;

<div align="left"><figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2FI7Y4sIR7USDar4FfTta7%2Fimage.png?alt=media&amp;token=5c3f3e1a-7b53-4db8-9c7c-4b0cca2ef268" alt="" width="427"><figcaption></figcaption></figure></div>

Enable journal (optional for diagnostic tracing) \
Enable security for 'everyone'&#x20;

<div align="left"><figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2F6z1QHQbxr9Sf83h0YXFH%2Fimage.png?alt=media&amp;token=0ac0a0be-df51-4a72-8f6a-f7062a9abd9c" alt="" width="536"><figcaption></figcaption></figure></div>

#### Xytech MPSE configuration

Edit the configuration file: *MediaPulseServiceEngine.exe.config*

**Listener**

Add CalendarAdaptorService and RouterQueue logging\
Set a suitable location value for the log files for the 'customlocation' parameter. \
Set level of logging for 'switchName':

* Everything
* InfoAndWarningsAndErrors
* WarningsAndErrors
* ErrorOnly

```xml
<source name="CalendarAdapterService"
		switchName="Everything"
		switchType="System.Diagnostics.SourceSwitch">
	<listeners>
		<add name="XytechListener"
			 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
			 initializeData="FileLogWriter"
			 location="Custom"
			 customLocation="C:\Program Files\Xytech\Logs"
			 logFileCreationSchedule="Daily"
			 traceOutputOptions="DateTime"
			 maxFileSize="25000000"
			 baseFileName="CalendarAdapterService"/>
		<remove name="Default"/>
	</listeners>
</source>
			<source name="RouterQueue"
		switchName="Everything"
		switchType="System.Diagnostics.SourceSwitch">
	<listeners>
		<add name="RouterQueue"
			 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
			 initializeData="FileLogWriter"
			 location="Custom"
			 customLocation="C:\Program Files\Xytech\Logs"
			 logFileCreationSchedule="Daily"
			 traceOutputOptions="DateTime"
			 maxFileSize="25000000"
			 baseFileName="RouterQueue"/>
		<remove name="Default"/>
	</listeners>
</source>
```

**RouterQueue**

Add a a calendar router queue. \
Note the name must be 'ExchangeInterface' for the MSMQ defined in the step above.

```xml
<key name="ExchangeInterface" value=".\Private$\XytechCalendar"/>
```

Example in context of the MPSE config:&#x20;

<figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2FRYhYX8gVLH51nRMqAWJn%2Fimage.png?alt=media&amp;token=fa77598c-794c-476c-9932-2d3c58eec6f4" alt="" width="563"><figcaption></figcaption></figure>

**Service Configuration for Microsoft Azure calendar**

Need values for:

* DB Name
* REST API Base URL
* Xytech DB System user & password
* Queue Names
* Azure App registration details
* Impersonation Email - master calendar

```xml
<services>
	<service name="CalendarAdapterService" type="MediaPulse.DigitalOrderServices.CalendarAdapter.CalendarAdapter">
		<keys>
			<key name="Verbose" value="Y" />
			<key name="MpDbName" value="MP_DEMO" />
			<key name="MpRestApiUri" value="http://localhost/xytech/api/v2/database/MP_DEMO" />
			<key name="MpUsername" value="xytech" />
			<key name="MpPassword" value="password" />
			<key name="QueueName" value=".\Private$\XytechCalendar" />
			<key name="StatusQueue" value=".\Private$\XytechCalendarStatus" />
			<key name="CheckEmailIntervalInSeconds" value="30" />
			<key name="CalendarProvider" value="Exchange" />
			<key name="CalendarTokenUrl" value="https://login.microsoftonline.com/94fb7681-xxxx-42ff-a3cb-ddc177452a36/oauth2/v2.0/token" />
			<key name="CalendarBaseApiUrl" value="https://graph.microsoft.com/v1.0/" />
			<key name="CalendarGrantType" value="client_credentials" />
			<key name="CalendarScope" value="https://graph.microsoft.com/.default" />
			<key name="ClientId" value="8003b4d8-xxxx-xxxx-xxxx-9d26d27806ed" />
			<key name="ClientSecret" value="f0cea19d-xxxx-xxxx-xxxx-20139c1200dc" />
			<key name="ImpersonationEmail" value="XytechCalendar@151pcl.onmicrosoft.com" />
		</keys>
	</service>
</services>
```

**Service Configuration for Google Workspace calendar**

Need values for:

* DB Name
* REST API Base URL
* Xytech DB System user & password
* Queue Names
* Service Account Email
* Impersonation Email (master calendar account)
* Certificate Name
* Certificate file Copy the certificate file into the root folder of the Xytech application – add double back-slashes.

```xml
<services>
	<service name="CalendarAdapterService" type="MediaPulse.DigitalOrderServices.CalendarAdapter.CalendarAdapter">
		<keys>
			<key name="Verbose" value="Y" />
			<key name="MpDbName" value="MP_DEMO" />
			<key name="MpRestApiUri" value="http://localhost/xytech/api/v2/database/MP_DEMO" />
			<key name="MpUsername" value="xytech" />
			<key name="MpPassword" value="password" />
			<key name="QueueName" value=".\Private$\XytechCalendar" />
			<key name="StatusQueue" value=".\Private$\XytechCalendarStatus" />
			<key name="CheckEmailIntervalInSeconds" value="30" />
			<key name="CalendarProvider" value="Google" />
			<key name="CalendarLoginUrl" value="https://accounts.google.com/o/oauth2/auth"/>
			<key name="CalendarTokenUrl" value="https://oauth2.googleapis.com/token"/>
			<key name="CalendarBaseApiUrl" value="https://www.googleapis.com/"/>
			<key name="CalendarGrantType" value="urn:ietf:params:oauth:grant-type:jwt-bearer"/>
			<key name="CalendarScope" value="https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events"/>
			<key name="ServiceAccountEmail" value="xytech@xytechcalendarintegration.iam.gserviceaccount.com"/>
			<key name="ImpersonationEmail" value="xytech@woogy.co.uk"/>
			<key name="CertificateName" value="C:\\Program Files\\Xytech\\xytechcalendarintegration-940ef64be40c.p12"/>
			<key name="CertificatePassword" value="notasecret"/>
		</keys>
	</service>
</services>
```

### Xytech UI config key parameters

#### Scheduling - Preferences

Navigate to: Scheduling - Setup - Preferences Scheduling\
Configure Calendar Invitations using Event Triggers = true

#### Phases

Enable phases for calendar invites.\
Navigate to: Job Management - Setup - Phases\
Edit the details of a selected phase.

<figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2FmP56ZuttcwQSlWqdf4Xr%2Fimage.png?alt=media&amp;token=bdce5a36-d8ee-4c41-86bd-0611d58c73a8" alt=""><figcaption></figcaption></figure>

#### Off Types

For Off Types, like shifts, vacation, days off etc... \
Enable the Off Type for the Event Trigger to work. \
Navigate to: Scheduling - Setup - Off Types \
Check 'Schedule in Exchange Server' to enable the Off Type. \
Then create the Event Trigger <br>

**Event Triggers**

Setup Event Triggers as needed for Insert, Update triggers. \
Note: Deletion is handled automatically, no Event Trigger is required. \
Upon deleting a transaction that has sent an invite, and deletion for that invite will automatically be sent. \
\- Event Code: (unimportant what the text is, use something to identify similar triggers) \
\- Send to queue: no \
\- Notify Type: Invite

Personnel Scheduling Resource setup: \
Assign email and E-Mail Booking

<figure><img src="https://1088343513-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhfmaWTsQlyynPk9Ibvsq%2Fuploads%2FG80JunMFNlc9hCex574n%2Fimage.png?alt=media&amp;token=feb593db-b29c-45dc-b23b-17b9227a6b58" alt=""><figcaption></figcaption></figure>
