---
name: "m365_connect"
area: "microsoft365"
title: "Connect Microsoft 365"
price: "free"
method: "POST"
url: "https://api.conecto.chat/v1/tools/m365_connect"
mcp_server: "https://api.conecto.chat/mcp/microsoft365"
auth: "Authorization: Bearer <conecto_sk_ key>"
docs_url: "https://conecto.chat/tools/microsoft365/m365_connect"
---

# Connect Microsoft 365 (`m365_connect`)

Connects the company's Microsoft 365 through its own app, for the mailboxes the agent may act as.

Connect the company's own Microsoft 365 so the agent works in its Outlook mail, calendars and OneDrive files, which stay the source of truth. The company registers an app in Microsoft Entra ID with the application permissions Mail.ReadWrite, Mail.Send, Calendars.ReadWrite and Files.ReadWrite.All, and its admin consents. Give its tenant_id, client_id and client secret, and the mailboxes the agent may act as (it never acts as anyone else). Each mailbox is checked before anything is kept. On accounts with an owner, cancelling events and replacing files wait for the owner's approval by default. Free.

Price: Free. A call that fails costs nothing.

## Use it when

The company uses Outlook and OneDrive and wants the agent to work in them there.

## Say this to your agent

> Connect our Microsoft 365 for support@ only. Here is the app's tenant, client ID and secret.

## Inputs

| Name | Type | Required | Description | Allowed values | Default |
|---|---|---|---|---|---|
| `tenant_id` | string | yes | 3 to 120 characters. |  |  |
| `client_id` | string | yes | 3 to 120 characters. |  |  |
| `secret` | string | yes | The app's client secret. Never shown again. 8 to 2,000 characters. Stored encrypted and shown only as [redacted]. |  |  |
| `mailboxes` | array of strings | yes | The addresses the agent may act as, like support@ and sales@. 1 to 20 items. |  |  |

## Example

Written for Hansen & Voss, a restaurant-equipment wholesaler in Hamburg with 60 staff.

MCP: call `m365_connect` on the MCP server `https://api.conecto.chat/mcp/microsoft365` with these arguments:

```json
{
  "tenant_id": "hansenvoss.onmicrosoft.com",
  "client_id": "6b1f0c2e-example-app",
  "secret": "example-client-secret",
  "mailboxes": [
    "support@hansenvoss.example"
  ]
}
```

REST:

```bash
curl https://api.conecto.chat/v1/tools/m365_connect \
  -H "Authorization: Bearer $CONECTO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tenant_id": "hansenvoss.onmicrosoft.com", "client_id": "6b1f0c2e-example-app", "secret": "example-client-secret", "mailboxes": ["support@hansenvoss.example"]}'
```

## Response

```json
{
  "call_id": "5f0c8a2e-3b7d-4c1e-9a64-2d8e1f7b0c93",
  "tool": "m365_connect",
  "status": "succeeded",
  "replayed": false,
  "cost_usd": "$0.00",
  "balance_usd": "$19.75",
  "result": {
    "microsoft365": {
      "tenant_id": "hansenvoss.onmicrosoft.com",
      "mailboxes": [
        "support@hansenvoss.example"
      ],
      "connected_at": "2026-10-14T08:00:00+00:00"
    },
    "need_approval": [
      "m365_calendar_cancel",
      "m365_files_upload"
    ]
  }
}
```

`result`: microsoft365: tenant_id, mailboxes and connected_at; need_approval, the tools that now wait for the owner.

## Errors

| Code | Status | When | Fix |
|---|---|---|---|
| `invalid_input` | 400 | A mailbox is not an email address, or none was named. | Name 1 to 20 mailboxes. |
| `vendor_rejected` | 502 | Microsoft refused the tenant, client ID or secret, or a mailbox. | Check the app's permissions and the admin's consent. |

The refusals every tool can give (401 key, 402 balance, 429 limits) are on the errors page: https://conecto.chat/docs/errors.md

## Related

- [m365_mail_search](https://conecto.chat/tools/microsoft365/m365_mail_search.md): The newest messages in a mailbox folder, or those matching a search. Free up to 1,000,000 reads a month.
- [m365_mail_read](https://conecto.chat/tools/microsoft365/m365_mail_read.md): One message in full, with its body as text and its attachments' names. Free up to 1,000,000 reads a month.
- [m365_mail_send](https://conecto.chat/tools/microsoft365/m365_mail_send.md): Sends an email, or a reply in the same thread, as one of the company's mailboxes. $0.001 a call.
- [m365_calendar_events](https://conecto.chat/tools/microsoft365/m365_calendar_events.md): The events in a mailbox's calendar between two times, in UTC. Free up to 1,000,000 reads a month.
- [m365_calendar_create](https://conecto.chat/tools/microsoft365/m365_calendar_create.md): Adds an event to a mailbox's calendar and invites its attendees, with a Teams link if asked. $0.001 a call.
- [m365_calendar_cancel](https://conecto.chat/tools/microsoft365/m365_calendar_cancel.md): Cancels an event the mailbox organizes and tells its attendees; waits for the owner by default. $0.001 a call.
- [m365_files_search](https://conecto.chat/tools/microsoft365/m365_files_search.md): Files in a mailbox user's OneDrive whose name or words match. Free up to 1,000,000 reads a month.
- [m365_files_read](https://conecto.chat/tools/microsoft365/m365_files_read.md): A OneDrive file's words: text, PDF, Word, Excel or PowerPoint, up to 5 MB. Free up to 1,000,000 reads a month.
- [m365_files_upload](https://conecto.chat/tools/microsoft365/m365_files_upload.md): Writes a text file to a path in a mailbox user's OneDrive; replacing one waits for the owner. $0.001 a call.
- [m365_disconnect](https://conecto.chat/tools/microsoft365/m365_disconnect.md): Forgets the app's secret and the mailboxes; nothing in Microsoft 365 changes. Free.
