# Microsoft Office 365

{% hint style="info" %}
The following documentation is for **Microsoft Office 365 v2.2.5** *(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]` |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/books/reference/office365.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
