# Configuration guide: Schedule online meetings in Outlook

{% hint style="warning" %}
The configuration options on this page are only accessible to [administrators](https://docs.nexthink.com/platform/user-guide/administration/account-management/roles).

Refer to the [Usage guide: Schedule online meetings in Outlook](https://docs.nexthink.com/platform/library-packs/l1-support/workflow-schedule-online-meeting-outlook/usage-guide-proactive-password-reset) to use library content as a standard user.
{% endhint %}

## Prerequisites <a href="#pre-requisites" id="pre-requisites"></a>

This library pack contains content from the following [expansion products](https://docs.nexthink.com/platform/overview/products)

* [Flow - Workflows](https://docs.nexthink.com/platform/user-guide/workflows)

{% hint style="info" %}
Some of these products offer default access to their respective content and can still be used without [expansion products](https://docs.nexthink.com/platform/overview/products).

To learn more about default thresholds for expansion products, [visit the extended documentation](https://docs.nexthink.com/platform/library-packs/l1-support/workflow-schedule-online-meeting-outlook/broken-reference).
{% endhint %}

## **Included content and dependencies** <a href="#content-and-dependency" id="content-and-dependency"></a>

This library pack contains the following content and dependencies:

<table><thead><tr><th width="219">Type</th><th width="235">Name</th><th>Description</th></tr></thead><tbody><tr><td><a href="https://docs.nexthink.com/platform/user-guide/workflows">Workflows</a></td><td><strong>Schedule online meetings in Outlook</strong></td><td>Workflow for scheduling online meetings in Outlook calendar.</td></tr></tbody></table>

## Configuring Schedule online meetings in Outlook pack <a href="#configuration" id="configuration"></a>

{% hint style="info" %}
Adapt these suggested configuration steps to edit and customize content according to your organizational needs.
{% endhint %}

Follow these steps to install and configure content:

* Before configuration - Install library pack content from [Nexthink Library](https://docs.nexthink.com/platform/user-guide/nexthink-library)
* [Step 1 - Set up a registered Microsoft Entra ID app and configure Microsoft Graph API connector credentials](#step-2-set-up-a-registered-microsoft-entra-id-app-and-configure-microsoft-graph-api-connector-creden)
* [Step 2 - Configure global parameters](#step-3-configure-global-parameters)
* [Step 3 - Examine the custom JavaScript code of the Functions thinklets](#step-3-examine-the-custom-javascript-code-of-the-functions-thinklets)

### Step 1 - Set up a registered Microsoft Entra ID app and configure Microsoft Graph API connector credentials <a href="#step-2-set-up-a-registered-microsoft-entra-id-app-and-configure-microsoft-graph-api-connector-creden" id="step-2-set-up-a-registered-microsoft-entra-id-app-and-configure-microsoft-graph-api-connector-creden"></a>

Refer to the following documentation page to register the Microsoft Entra ID application and configure the appropriate connector credentials in Nexthink: [Entra ID integration for workflows](https://docs.nexthink.com/platform/library-packs/faq/entra-id-integration-for-workflows).

For this workflow, the registered Entra ID application must be granted the following permissions:

| Permission type | Least privileged permissions |
| --------------- | ---------------------------- |
| Application     | Calendars.ReadWrite          |

{% hint style="info" %}
This workflow has been tested using the Application permission type. Different environments require different permissions. You should assign permissions according to your environment and know the risks involved.
{% endhint %}

Refer to the Graph REST API documentation from Microsoft for more information:

* [Graph REST API documentation - GetSchedule](https://learn.microsoft.com/en-us/graph/api/calendar-getschedule?view=graph-rest-1.0\&tabs=http)
* [Graph REST API documentation - CreateEvent](https://learn.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0\&tabs=http)

### Step 2 -Configure global parameters <a href="#step-3-configure-global-parameters" id="step-3-configure-global-parameters"></a>

There are the following global parameters in this workflow:

* Timezone
* Participant
* Subject
* Content
* meetingDurationMinutes
* Location

The table below outlines the purpose and default value of each parameter.

| Name                   | Default value                | Description                                                     |
| ---------------------- | ---------------------------- | --------------------------------------------------------------- |
| Timezone               | Central Europe Standard Time | Name of the time zone                                           |
| Participant            | N/A                          | Email address of the participant                                |
| Subject                | Appointment                  | This text would appear in the subject field of the meeting.     |
| Content                | Meeting description          | This text would appear in the description field of the meeting. |
| meetingDurationMinutes | 60                           | The duration of the meeting is in minutes.                      |
| Location               | Default location             | This text would appear in the location field of the meeting.    |

### Step 3 - Examine the custom JavaScript code of the Functions thinklets

#### 'Start and End date' function

The thinklet contains the following custom JavaScript code:

```
function nextBusinessDay(fromDate = new Date()) {
    const nextDay = new Date(fromDate);
    do {
        nextDay.setDate(nextDay.getDate() + 1);
    } while ([0, 6].includes(nextDay.getDay()));
    return nextDay;
}

function toLocalISOString(date, offsetHours = 0, offsetMinutes = 0) {
    const offsetDate = new Date(date);
    offsetDate.setHours(offsetHours, offsetMinutes, 0, 0);

    // Build timedate string: 'YYYY-MM-DDTHH:MM:SS'
    return offsetDate.getFullYear() +
        '-' + String(offsetDate.getMonth() + 1).padStart(2, '0') +
        '-' + String(offsetDate.getDate()).padStart(2, '0') +
        'T' + String(offsetDate.getHours()).padStart(2, '0') +
        ':' + String(offsetDate.getMinutes()).padStart(2, '0') +
        ':00';
}

const nextDay = nextBusinessDay();
outputs.start = toLocalISOString(nextDay, 9);   
outputs.end = toLocalISOString(nextDay, 17);    

nxLogger.log(`Start: ${outputs.start}`);
nxLogger.log(`End: ${outputs.end}`);
```

#### 'Check availability' function

The thinklet contains the following custom JavaScript code:

```
function nextBusinessDay(fromDate = new Date()) {
    const nextDay = new Date(fromDate);
    do {
        nextDay.setDate(nextDay.getDate() + 1);
    } while ([0, 6].includes(nextDay.getDay()));
    return nextDay;
}

function toLocalISOString(date, offsetHours = 0, offsetMinutes = 0) {
    const offsetDate = new Date(date);
    offsetDate.setHours(offsetHours, offsetMinutes, 0, 0);

    // Build timedate string: 'YYYY-MM-DDTHH:MM:SS'
    return offsetDate.getFullYear() +
        '-' + String(offsetDate.getMonth() + 1).padStart(2, '0') +
        '-' + String(offsetDate.getDate()).padStart(2, '0') +
        'T' + String(offsetDate.getHours()).padStart(2, '0') +
        ':' + String(offsetDate.getMinutes()).padStart(2, '0') +
        ':00';
}

const nextDay = nextBusinessDay();
outputs.start = toLocalISOString(nextDay, 9);   
outputs.end = toLocalISOString(nextDay, 17);    

nxLogger.log(`Start: ${outputs.start}`);
nxLogger.log(`End: ${outputs.end}`);
```

***

RELATED TOPICS

* [Workflow: Schedule online meetings in Outlook](https://docs.nexthink.com/platform/library-packs/l1-support/workflow-schedule-online-meeting-outlook)
* [Usage guide: Schedule online meetings in Outlook](https://docs.nexthink.com/platform/library-packs/l1-support/workflow-schedule-online-meeting-outlook/usage-guide-proactive-password-reset)
* [Manage Workflows](https://docs.nexthink.com/platform/user-guide/workflows/managing-workflows)
