> For the complete documentation index, see [llms.txt](https://docs.kognitos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kognitos.com/legacy/legacy-experience/books/reference/office365.md).

# Microsoft Office 365

Procedures and concepts for the Microsoft Office 365 integration.

{% hint style="info" %}
The following documentation is for **Microsoft Office 365 v2.14.3** *(BDK)*.
{% endhint %}

## Overview

Microsoft Office 365 provides comprehensive productivity suite with cloud-based collaboration and communication tools. This integration enables automated workflow management across Word, Excel, PowerPoint, and other Office applications. Enhance productivity and streamline business processes through integrated Microsoft ecosystem automation.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **Microsoft Office 365**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

### Connect using Client ID, Client Secret and Tenant ID

Connect to the Microsoft Graph API using the provided client credentials.

| Label         | Description                                                  | Type        |
| ------------- | ------------------------------------------------------------ | ----------- |
| Client ID     | The client ID of the application registered in Azure AD.     | `text`      |
| Client Secret | The client secret of the application registered in Azure AD. | `sensitive` |
| Tenant ID     | The tenant ID of the Azure AD directory.                     | `text`      |

### Connect using Client ID, Certificate and Tenant ID

Connect to the Microsoft Graph API using certificate credentials.

| Label       | Description                                                                           | Type        |
| ----------- | ------------------------------------------------------------------------------------- | ----------- |
| Client ID   | The client ID of the application registered in Azure AD.                              | `text`      |
| Certificate | PEM-encoded X.509 certificate string containing both the certificate and private key. | `sensitive` |
| Tenant ID   | The tenant ID of the Azure AD directory.                                              | `text`      |

### Connect using Client ID, Certificate, Private Key and Tenant ID

Connect to the Microsoft Graph API using certificate and private key.

| Label       | Description                                              | Type        |
| ----------- | -------------------------------------------------------- | ----------- |
| Client ID   | The client ID of the application registered in Azure AD. | `text`      |
| Certificate | PEM-encoded certificate string.                          | `sensitive` |
| Private Key | PEM-encoded private key string.                          | `sensitive` |
| Tenant ID   | The tenant ID of the Azure AD directory.                 | `text`      |

## Procedures

### to get a (group's members) from *office365*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Retrieves members of an Office 365 group accessible via the Microsoft Graph API.

It requires the following permissions on the application: Directory.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.ReadWrite.All

**Input Concepts**

| Concept                  | Description                                             | Type           | Required | Default Value |
| ------------------------ | ------------------------------------------------------- | -------------- | -------- | ------------- |
| [`group`](#office-group) | The Office 365 group whose members are to be retrieved. | `office group` | Yes      | (no default)  |

**Output Concepts**

| Concept                           | Description                                                        | Type          |
| --------------------------------- | ------------------------------------------------------------------ | ------------- |
| [`group's members`](#office-user) | A list of Office 365 users who are members of the specified group. | `office user` |

**Examples**

Retrieve all members of the specified group

```generic
get groups from office365 whose mail is "group@acme.org"
get the first group
get the above's members from office365
```

### to get some (groups) from *office365*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Get Office 365 groups accessible via the Microsoft Graph API.

It requires the following permissions on the application: Group.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All, Group.Read.All

**Output Concepts**

| Concept                   | Description                  | Type           |
| ------------------------- | ---------------------------- | -------------- |
| [`groups`](#office-group) | A list of Office 365 groups. | `office group` |

**Examples**

Retrieve all groups

```generic
get groups from office365
```

Retrieve a group whose email matches the specified email.

```generic
get groups from office365 whose mail is "group@acme.org"
```

### to get some (users) from *office365*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Get Office 365 users accessible via the Microsoft Graph API.

It requires the following permissions on the application: User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All

**Output Concepts**

| Concept                 | Description                 | Type          |
| ----------------------- | --------------------------- | ------------- |
| [`users`](#office-user) | A list of Office 365 users. | `office user` |

**Examples**

Retrieve all users

```generic
get users from office365
```

Retrieve a user whose email matches the specified email address

```generic
get users from office365 whose mail is "john@acme.org"
```

## Concepts

### Office group

An Office Group represents a group in the Microsoft Graph. It includes key user details such as display name,and email address.

| Field Name      | Description                                           | Type             |
| --------------- | ----------------------------------------------------- | ---------------- |
| `id`            | The unique identifier for the group.                  | `text`           |
| `display_name`  | The name displayed in the address book for the group. | `optional[text]` |
| `email_address` | The group's email address.                            | `optional[text]` |

### Office user

An Office User represents a user in the Microsoft Graph. It includes key user details such as display name,email address, and job title.

| Field Name      | Description                                                   | Type             |
| --------------- | ------------------------------------------------------------- | ---------------- |
| `id`            | The unique identifier for the user.                           | `text`           |
| `display_name`  | The name displayed in the address book for the user.          | `optional[text]` |
| `email_address` | The user's email address (usually their user principal name). | `optional[text]` |
| `job_title`     | The user's job title.                                         | `optional[text]` |
