---
name: iblai-connect-microsoft-365
description: "Read and write Microsoft 365 & SharePoint data through the Microsoft Graph REST API v1.0 and expose it to an ibl.ai agent as an MCP tool. Use when the user asks an agent to work with Microsoft 365 & SharePoint data, or to set up a Microsoft 365 & SharePoint MCP connection on ibl.ai."
metadata:
  kind: guide
---

# Microsoft 365 & SharePoint connector for AI agents

> A starting point maintained on ibl.ai at https://ibl.ai/developer/connectors/microsoft-365 — not part of the iblai/vibe repository. Checked against Microsoft's documentation on October 20, 2026; test it against your own Microsoft 365 & SharePoint setup before you rely on it.

Microsoft 365 holds an organization's email, calendars, files and chats: Outlook/Exchange mailboxes, OneDrive and SharePoint sites, lists and document libraries, Teams channels and chats, and Microsoft Entra users and groups.

## Auth & conventions

- **API:** Microsoft Graph REST API v1.0 (REST). One endpoint for Microsoft 365 data: users and groups, Outlook mail and calendar, OneDrive and SharePoint sites, lists, list items and drives, Teams teams, channels and messages. Supports JSON batching, delta queries and change notifications.
- **Base URL:** https://graph.microsoft.com/v1.0/
- **Access:** Issued by your administrator. Register an app in the Microsoft Entra admin center to get an application ID and credential. Delegated permissions need user or admin consent; application permissions and higher-impact scopes need admin consent.
- **Auth:** OAuth 2.0 authorization code (delegated); OAuth 2.0 client credentials (application). Microsoft identity platform issues a Bearer token. Delegated permissions (scopes) act for a signed-in user, limited by that user's own access; application permissions (app roles) act as the app with no user. Credential: secret, certificate or federated.
- **Limits:** Throttling returns HTTP 429 with a Retry-After header; wait that many seconds, else use exponential backoff. Limits vary by service and request type. Each request in a JSON batch is throttled separately. Use delta queries instead of polling.
- Keep Microsoft 365 & SharePoint credentials in environment variables or the ibl.ai credential store. Never print a token in chat and never commit one to a file.
- Destructive or outward-facing calls are marked **Confirm with the user first** — do.

## Reads

- **Mail** — Read a mailbox with GET /me/messages or /users/{id}/messages; supports $filter, $select and $top.
- **Calendar events** — List events with GET /me/events or /users/{id}/events.
- **SharePoint sites and lists** — GET /sites/{site-id}, /sites/{site-id}/lists and /sites/{site-id}/lists/{list-id}/items; sites can be addressed by hostname and path.
- **Files (OneDrive, SharePoint)** — Enumerate document libraries with /sites/{site-id}/drives and a user's files with /me/drive/root/children.
- **Users and groups** — GET /users and /groups for the directory, /me/manager and /me/memberOf for relationships.

## Writes

- **Send email** — POST /me/sendMail or /users/{id}/sendMail; needs Mail.Send. Returns 202 Accepted and saves to Sent Items by default. **Confirm with the user first.**
- **Teams channel message** — POST /teams/{team-id}/channels/{channel-id}/messages with delegated ChannelMessage.Send; application permission is for migration only. **Confirm with the user first.**
- **SharePoint list items** — Create and update listItems; the SharePoint API is read-write for lists, listItems and driveItems but cannot create sites.
- **Files** — Upload or update driveItems in OneDrive or a SharePoint document library.

## Expose it to an ibl.ai agent (MCP)

Microsoft publishes an official MCP server, Work IQ MCP (https://learn.microsoft.com/en-us/microsoft-365/copilot/extensibility/work-iq/mcp/overview). Register it below as-is, or host your own server that wraps the calls in this skill.

First install the ibl.ai platform skills and connect your organization (writes `IBLAI_ORG`, `IBLAI_USERNAME` and `IBLAI_API_KEY` to `.env`):

```bash
npx skills add iblai/vibe --all
# then, in your coding agent:
/iblai-api-login
```

Every call below sends `Authorization: Api-Token $IBLAI_API_KEY`.

1. **Register the server** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-servers/` with `name`, `url`, `transport` (`sse` | `websocket` | `streamable_http`) and `auth_type` (`none` | `token` | `oauth2`). Capture the returned `id`.
   - Microsoft 365 & SharePoint supports per-user OAuth: `auth_type=oauth2` with `auth_scope=user` and a linked `oauth_service` makes each person connect their own account in the chat. It needs an `auth_{provider}` credential in the organization's credential store first.
2. **Create the connection** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-server-connections/` with `server`, `scope` (`platform` | `mentor` | `user`), `auth_type`, and either `credentials` + `authorization_scheme` or a `connected_service` id for OAuth. Credentials are masked on read; never send a masked value back.
3. **Enable it on the agent** — `GET https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mentors/{agent_id}/settings/`, add `mcp-tool` to `tool_slugs` and the server id to `mcp_servers`, then `PATCH` the full lists back. They are replaced, not merged.

Full reference: https://ibl.ai/developer/platform/mcp/mcp-connections and the `/iblai-api-agent-mcp` skill.

## Example prompts

- "Summarize unread emails from my manager this week and draft replies"
- "List every item in the Contracts list on the Legal SharePoint site that expires in Q1"
- "Find the latest version of the pricing deck in our Sales document library"
- "Post the release notes to the Engineering channel in Teams"

## Guardrails

- Mailboxes, files and chats hold confidential business data and personal data; content may include regulated records (health, financial, student) depending on the organization.
- Request the narrowest Microsoft 365 & SharePoint scopes or role the task needs, and prefer a read-only credential for agents that only answer questions.
- Return the fields the user asked for, not whole records; do not paste personal data into chat that the user did not request.
- Before any write, show the user exactly what will change and wait for a yes.
- Respect the documented limits above: page through results and back off on rate-limit responses instead of retrying in a loop.

## References

- Microsoft Graph overview: https://learn.microsoft.com/en-us/graph/overview
- Graph authentication and authorization basics: https://learn.microsoft.com/en-us/graph/auth/auth-concepts
- Work IQ MCP overview: https://learn.microsoft.com/en-us/microsoft-365/copilot/extensibility/work-iq/mcp/overview
- Work IQ MCP: https://learn.microsoft.com/en-us/microsoft-365/copilot/extensibility/work-iq/mcp/overview
- This connector on ibl.ai: https://ibl.ai/developer/connectors/microsoft-365
- ibl.ai MCP server connections: https://ibl.ai/developer/platform/mcp/mcp-connections
