# Microsoft Outlook

Allow Suger to access your Microsoft Outlook account to send, receive, and manage emails on your behalf.

---

## Overview

By integrating Suger with Microsoft Outlook, users can leverage automation workflows to enhance email productivity.
Tasks such as sending emails can be automated, improving efficiency and enabling customized email workflows tailored to specific business needs.

### Org-Level vs User-Level

> **Org-Level**: Uses Azure AD app registration for organization-wide access.
> **User-Level**: Each user authenticates via Microsoft OAuth for personal Outlook access.

## Create Integration (Org-Level)

1. Click the `Connect Now` button, you will be redirected to the Microsoft OAuth2.0 authentication page.

> ![Microsoft Outlook Connect Now](images/microsoft_outlook_connect_now.jpg)

2. Click the `Accept` button to grant Suger permission to access your Outlook account. This authorization enables Suger to read, send emails on your behalf.

> ![Microsoft Outlook User Consent](images/microsoft_outlook_user_consent.jpg)

3. After the authorization is granted, you will be redirected to the Suger console. You can see the integration is connected successfully.

4. Verify the integration by clicking the `Verify` button. If the integration is successful, you will see the `Verified` status.

## Create User Integration

1. Click the `Connect Now` button in the User Integrations section, you will be redirected to the Microsoft OAuth2.0 authentication page.

> ![Microsoft Outlook Connect Now](images/user_microsoft_outlook_connect_now.jpg)

2. Click the `Accept` button to grant Suger permission to access your Outlook account. This authorization enables Suger to read, send emails on your behalf.

> ![Microsoft Outlook User Consent](images/user_microsoft_outlook_user_consent.jpg)

3. After the authorization is granted, you will be redirected to the Suger console. You can see the integration is connected successfully.

4. Verify the integration by clicking the `Verify` button. If the integration is successful, you will see the `Verified` status.

## Suger AI Tools

Suger AI uses a **middleware** strategy — wrapping the Microsoft Graph Mail API directly.

> **Org-level and user-level**: Both integration levels are supported. User-level takes precedence when both are connected.

**Profile & Folders**

| Tool | Description |
|------|-------------|
| `outlookmail_get_profile` | Get the authenticated user's Outlook profile |
| `outlookmail_list_folders` | List all mail folders with unread counts |

**Messages**

| Tool | Description |
|------|-------------|
| `outlookmail_list_messages` | List messages with OData filter or full-text search |
| `outlookmail_get_message` | Get a full message including body and attachments list |
| `outlookmail_send_mail` | Send an email (plain text or HTML) |
| `outlookmail_reply_to_message` | Reply to a message preserving threading |
| `outlookmail_update_message` | Mark as read/unread, flag, or assign categories |
| `outlookmail_move_message` | Move a message to another folder |
| `outlookmail_delete_message` | Move a message to Deleted Items |

**Drafts**

| Tool | Description |
|------|-------------|
| `outlookmail_list_drafts` | List saved drafts |
| `outlookmail_create_draft` | Save an email as a draft |
| `outlookmail_update_draft` | Replace a draft's content |
| `outlookmail_send_draft` | Send a previously saved draft |
| `outlookmail_delete_draft` | Permanently delete a draft |

## Edit Integration

For security purposes, editing an existing Microsoft Outlook integration is not allowed. The practical way is to delete it and then re-create it from the beginning.

## Delete Integration

The Microsoft Outlook integration can be deleted like all other integrations. Once the deletion is triggered, all integration info including the credentials and access tokens will be deleted immediately & permanently from Suger. No time window or methods to recover.

:::warning
- **Org-Level**: To completely delete the integration, please revoke the application permissions or delete the app registration from Azure Active Directory as well.
- **User-Level**: Deleting the integration in Suger does not automatically revoke permissions granted in Microsoft. To fully disable access, the user must also revoke the application's permissions.

**Steps to revoke Microsoft Outlook permissions (User-Level):**
1. Go to Microsoft Account → Privacy
2. Select Apps and services
3. Locate the Suger application that was granted Outlook access
4. Click Remove these permissions
:::
