> ## Documentation Index
> Fetch the complete documentation index at: https://ai-kb.automationanywhere.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Office 365 Toolkit

> Search and send Outlook mail, manage drafts and attachments, and work with calendar events from within a workflow.

The **Office 365 Toolkit** lets your workflows interact with Outlook email and calendar through Microsoft Graph — searching and reading messages, handling attachments, sending or drafting mail, and searching or creating calendar events.

For related agent chat toolkits, see [Microsoft Outlook](/agents/toolkits/microsoft-365), [Microsoft Teams](/agents/toolkits/microsoft-365), [Microsoft Excel](/agents/toolkits/microsoft-excel), and [Microsoft Word](/agents/toolkits/microsoft-word).

## Prerequisites

* A workflow you can edit
* A connected Office 365 account (personal **or** team) available to the node
* Azure AD app permissions granted for Mail and Calendar (admin consent may be required)
* Message IDs, attachment IDs, or datetime values from earlier nodes — or `@` variables that supply them

## Authentication

All Office 365 tools require an Office 365 account connection. Each tool includes an **Office 365 Account** selector:

| Option                        | Description                                                       |
| ----------------------------- | ----------------------------------------------------------------- |
| **Use my Office 365 account** | Uses your personal connected Office 365 account.                  |
| **Use team account**          | Uses a shared team Office 365 account configured for the project. |

If no account is connected, click **Connect Office 365 Account** to authenticate with Microsoft.

Required Microsoft Graph scopes include `Mail.ReadWrite`, `Mail.Send`, `Calendars.ReadWrite`, `User.Read`, and `offline_access`.

## Tools

### Search Emails

Search Outlook emails using Microsoft Graph. Returns structured message metadata and excerpts. Supports KQL-style queries.

| Field                       | Required | Description                                                                                                            |
| --------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| **Office 365 Account**      | Yes      | Select your personal or team Office 365 account.                                                                       |
| **Query**                   | Yes      | Search query to filter Outlook emails (KQL syntax supported). Type `@` to select a variable.                           |
| **Folder**                  | No       | Mailbox folder to search. Leave blank for Inbox. Default is empty.                                                     |
| **Max Results**             | No       | Maximum number of messages to return. Default is `10`.                                                                 |
| **Include Attachments**     | No       | When enabled, fetch attachment metadata (filename, size, type). Does not include binary data. Default is `false`.      |
| **Include Attachment Data** | No       | When enabled, include full binary attachment data (base64). Intended for workflows, not AI agents. Default is `false`. |

### Read Email

Read a single Outlook message by Microsoft Graph message ID (from **Search Emails**). Returns the full body, headers, and optional attachment metadata.

| Field                          | Required | Description                                                                                          |
| ------------------------------ | -------- | ---------------------------------------------------------------------------------------------------- |
| **Office 365 Account**         | Yes      | Select your personal or team Office 365 account.                                                     |
| **Message Id**                 | Yes      | Microsoft Graph message ID. Type `@` to select a variable (for example from search results).         |
| **Include Attachment Summary** | No       | When enabled, include attachment id, name, size, and type without binary content. Default is `true`. |

### Read Attachments

List all attachments on a message (id, filename, MIME type, size, inline flag). Does not return file bytes.

| Field                  | Required | Description                                                                          |
| ---------------------- | -------- | ------------------------------------------------------------------------------------ |
| **Office 365 Account** | Yes      | Select your personal or team Office 365 account.                                     |
| **Message Id**         | Yes      | Microsoft Graph message ID whose attachments to list. Type `@` to select a variable. |

### Download Attachments

Download file attachments as base64 (`contentBytes`). Use attachment IDs from **Read Attachments**; omit IDs to fetch all non-inline files (capped at 25).

| Field                  | Required | Description                                                                                                               |
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Office 365 Account** | Yes      | Select your personal or team Office 365 account.                                                                          |
| **Message Id**         | Yes      | Microsoft Graph message ID. Type `@` to select a variable.                                                                |
| **Attachment Ids**     | No       | Comma-separated Graph attachment IDs. Leave empty to download all non-inline file attachments (max 25). Default is empty. |

### Send Message

Send an email through Outlook. Use only when the workflow intentionally sends mail.

| Field                  | Required | Description                                                   |
| ---------------------- | -------- | ------------------------------------------------------------- |
| **Office 365 Account** | Yes      | Select your personal or team Office 365 account.              |
| **Body**               | Yes      | HTML or plain text email body. Type `@` to select a variable. |
| **To**                 | Yes      | List of recipient email addresses.                            |
| **Subject**            | Yes      | Subject line for the email. Type `@` to select a variable.    |
| **Cc**                 | No       | Optional CC recipients. Default is `null`.                    |
| **Bcc**                | No       | Optional BCC recipients. Default is `null`.                   |

### Create Draft Message

Create an Outlook draft email for later review or approval.

| Field                  | Required | Description                                                   |
| ---------------------- | -------- | ------------------------------------------------------------- |
| **Office 365 Account** | Yes      | Select your personal or team Office 365 account.              |
| **Body**               | Yes      | HTML or plain text email body. Type `@` to select a variable. |
| **To**                 | Yes      | List of recipient email addresses.                            |
| **Subject**            | Yes      | Subject line for the draft. Type `@` to select a variable.    |
| **Cc**                 | No       | Optional CC recipients. Default is `null`.                    |
| **Bcc**                | No       | Optional BCC recipients. Default is `null`.                   |

### Search Events

Search calendar events within a timeframe. Useful for agenda lookups and meeting summaries.

| Field                  | Required | Description                                                                                 |
| ---------------------- | -------- | ------------------------------------------------------------------------------------------- |
| **Office 365 Account** | Yes      | Select your personal or team Office 365 account.                                            |
| **Start Datetime**     | Yes      | ISO 8601 start datetime (for example `2024-03-10T09:00:00`). Type `@` to select a variable. |
| **End Datetime**       | Yes      | ISO 8601 end datetime. Type `@` to select a variable.                                       |
| **Max Results**        | No       | Maximum number of events to return. Default is `10`.                                        |
| **Truncate**           | No       | Whether to truncate long fields. Default is `true`.                                         |
| **Truncate Limit**     | No       | Character limit used when truncating. Default is `150`.                                     |

### Send Event

Schedule a calendar event in Outlook with attendees and a description.

| Field                  | Required | Description                                                            |
| ---------------------- | -------- | ---------------------------------------------------------------------- |
| **Office 365 Account** | Yes      | Select your personal or team Office 365 account.                       |
| **Body**               | Yes      | Event description (HTML or plain text). Type `@` to select a variable. |
| **Attendees**          | Yes      | Email addresses of meeting attendees.                                  |
| **Subject**            | Yes      | Event subject. Type `@` to select a variable.                          |
| **Start Datetime**     | Yes      | ISO 8601 start datetime. Type `@` to select a variable.                |
| **End Datetime**       | Yes      | ISO 8601 end datetime. Type `@` to select a variable.                  |

## Tips

* Prefer `@` variables for message IDs and attachment IDs from earlier nodes (search → read → download)
* Keep **Include Attachment Data** off unless a later node needs the binary content
* Use **Create Draft Message** when a human should review mail before it is sent
* Use ISO 8601 datetimes (with timezone when possible) for calendar tools
* For mail and calendar in agent chat, use [Microsoft Outlook](/agents/toolkits/microsoft-365) instead of this workflow toolkit

## Troubleshooting

| Symptom                                   | What to check                                                                                                                                                                                         |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Account selector empty                    | Connect personal or team Office 365; refresh the workflow editor                                                                                                                                      |
| Authentication or consent errors          | Confirm Azure AD app permissions and admin consent for Mail and Calendar scopes                                                                                                                       |
| Empty search results                      | Verify **Query** / folder and that the connected mailbox has matching messages                                                                                                                        |
| Attachment download fails or is truncated | Confirm attachment IDs from **Read Attachments**; omit IDs only when you need all non-inline files (max 25)                                                                                           |
| Confused with agent Microsoft toolkits    | Agent chat is split across [Outlook](/agents/toolkits/microsoft-365), [Teams](/agents/toolkits/microsoft-365), [Excel](/agents/toolkits/microsoft-excel), and [Word](/agents/toolkits/microsoft-word) |

## Related

* [Microsoft Outlook](/agents/toolkits/microsoft-365)
* [Microsoft Teams](/agents/toolkits/microsoft-365)
* [Microsoft Excel](/agents/toolkits/microsoft-excel)
* [Microsoft Word](/agents/toolkits/microsoft-word)
* [Communication triggers](/tools/nodes/triggers/communication-triggers) (incoming email, including `office365`)
* [Toolkits overview](/tools/nodes/toolkits/toolkits-overview)
