# Outlook Agent

<table data-card-size="large" data-column-title-hidden data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><strong>Overview</strong></td><td><ul><li>Search and retrieve emails, calendar events, and contacts from Outlook through Blockbrain</li><li>Send, read, and manage emails directly within Blockbrain</li><li>Access and update calendar appointments and meeting details</li><li>Extract and summarize email or calendar content for reporting or AI analysis</li><li>Automate email and calendar workflows using Outlook data</li></ul></td><td><a href="/files/ikR2AL5octrVSvEocI7Z">/files/ikR2AL5octrVSvEocI7Z</a></td></tr><tr><td><strong>Prerequisites</strong></td><td><ul><li>Complete the <a href="https://docs.en.theblockbrain.ai/for-users/agents">general setup steps</a> from the main AI Agents page</li><li>Ensure users have active Microsoft 365 or Exchange Online mailboxes</li><li>Verify appropriate Microsoft 365 licensing for Outlook and related services</li></ul></td><td><a href="/files/X7MpGP1nVARHAWPFype1">/files/X7MpGP1nVARHAWPFype1</a></td></tr></tbody></table>

### Azure App Registration Configuration

#### Required API Permissions

Add the following Microsoft Graph permissions to your app registration:

| Permission              | Type      | Description                                         |
| ----------------------- | --------- | --------------------------------------------------- |
| `offline_access`        | Delegated | Maintain access to data you have given it access to |
| `User.Read`             | Delegated | Sign in and read user profile                       |
| `Mail.Send`             | Delegated | Send mail as the user                               |
| `Mail.ReadWrite`        | Delegated | Read and write access to user mail                  |
| `Calendars.ReadWrite`   | Delegated | Read and write user calendars                       |
| `Tasks.ReadWrite`       | Delegated | Read and write user tasks                           |
| `People.Read`           | Delegated | Read user's relevant people list                    |
| `Calendars.Read.Shared` | Delegated | Read user and shared calendars                      |

#### Permission Configuration Steps

1. In your Azure app registration, go to **API permissions**
2. Click **"Add a permission"** > **Microsoft Graph** > **Delegated permissions**
3. Search for and select each required permission
4. Click **"Add permissions"**
5. Click **"Grant admin consent"** (recommended for organization-wide deployment)

### Outlook Agent Configuration in Blockbrain

#### App Registration in Azure

Redirect URL: WEB <https://nango.theblockbrain.ai/oauth/callback>

* Scopes (in app)
  * `offline_access`
  * `User.Read`
  * `Mail.Send`
  * `Mail.ReadWrite`
  * `Calendars.ReadWrite`
  * `Tasks.ReadWrite`
  * `People.Read`
  * `Calendars.Read.Shared`
* Additional config
  * tenant "xyz" (ID from the app registration)

As an alternative, we can use default\
\&#xNAN;**.default** (uses all scopes set in app)\
(If Admin consent was set - will iuse the values set in Azure)

<figure><img src="/files/T3KW8hXJyovRnpbo8Z3H" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/7u4RqCyy1yVDWfSI70Hs" alt=""><figcaption></figcaption></figure>

#### Configuration Steps

1. **Access Agent Settings**:
   * Navigate to your Blockbrain admin panel
   * Go to **Agents** > **Outlook Agent**
   * Click **"Configure"**
2. **Enter Azure Credentials**:
   * **Client ID**: Enter the Application ID from your Azure app registration
   * **Client Secret**: Paste the client secret you generated (use the eye icon to toggle visibility)
   * **Tenant**: Enter your Azure tenant ID
3. **Configure OAuth Scopes**:
   * Add each required scope individually using the **"Add"** button as mentioned [here](#required-api-permissions)
   * Each scope appears as a removable tag with visual indicators
   * Use the **"X"** button to remove any incorrect scopes
4. **Additional Configuration** (Optional):
   * Configure custom key-value pairs for specific organizational requirements
   * Set up any specialized email handling rules
5. **Save Configuration**:
   * Click **"Save"** to apply all settings
   * Wait for the confirmation message

### Alternative: Admin Consent Configuration

For streamlined deployment with pre-approved permissions:

1. In Azure, grant admin consent for all required Microsoft Graph permissions
2. In Blockbrain configuration, use `.default` scope instead of individual scopes
3. This approach simplifies user onboarding by eliminating individual consent prompts

### Testing the Outlook Agent

#### Verification Steps

1. **Authentication Test**:
   * Use Blockbrain's built-in connection testing tool
   * Verify successful OAuth flow with Microsoft Graph
2. **Email Functionality**:
   * Test sending an email through the agent
   * Verify email reading and search capabilities
   * Check mail folder access
3. **Calendar Integration**:
   * Create a test calendar event
   * Verify calendar reading permissions
   * Test event modification capabilities
4. **Task Management**:
   * Create and modify a test task
   * Verify task list access
   * Check task completion workflows

### Common Outlook Integration Use Cases

#### Email Management

* **Automated Responses**: AI-powered email replies and drafting
* **Email Analysis**: Content analysis and sentiment detection
* **Search & Retrieval**: Find specific emails based on content or metadata

#### Calendar Integration

* **Meeting Scheduling**: AI-assisted meeting coordination
* **Event Creation**: Automated calendar event generation
* **Schedule Analysis**: Meeting pattern analysis and optimization

#### Task Automation

* **Task Creation**: Convert emails or conversations into actionable tasks
* **Progress Tracking**: Monitor task completion and deadlines
* **Workflow Integration**: Connect tasks with other business processes

### Troubleshooting

#### Authentication Issues

**Problem**: OAuth authentication failures

* **Solution**: Verify the redirect URL is exactly `https://nango.theblockbrain.ai/oauth/callback`
* **Check**: Ensure admin consent is granted for all required permissions
* **Verify**: Client secret hasn't expired and is correctly entered

#### Email Permission Errors

**Problem**: Cannot send or read emails

* **Solution**: Confirm `Mail.Send` and `Mail.ReadWrite` permissions are granted
* **Check**: Verify the user has an active Exchange Online mailbox
* **Validate**: Test with a different user account to isolate permission issues

#### Calendar Access Issues

**Problem**: Calendar events not accessible

* **Solution**: Ensure `Calendars.ReadWrite` permission is properly configured
* **Check**: Verify the user has calendar access in their Microsoft 365 account
* **Test**: Try accessing a shared calendar to confirm delegation permissions

#### Scope Configuration Problems

**Problem**: Scopes not being saved or recognized

* **Solution**: Add each scope individually using the interface
* **Check**: Remove any duplicate or malformed scopes
* **Verify**: Ensure all required scopes are present in the configuration

### Security and Compliance

#### Data Protection

* **Email Security**: All email data is handled according to Blockbrain's security policies
* **Calendar Privacy**: Calendar access respects user privacy settings and sharing permissions
* **Task Confidentiality**: Task data is processed with appropriate confidentiality measures

#### Compliance Considerations

* **GDPR Compliance**: Email and calendar data processing follows GDPR requirements
* **Data Retention**: Configure appropriate data retention policies for email and calendar data
* **Audit Logging**: All Outlook agent activities are logged for compliance reporting

#### Access Control

* **User Permissions**: Agent inherits the authenticated user's Outlook permissions
* **Delegation**: Supports Exchange delegation and shared mailbox access
* **Security Groups**: Can be configured to work with Azure AD security groups

### Performance Optimization

#### Email Processing

* **Batch Operations**: Configure batch processing for large email operations
* **Rate Limiting**: Respect Microsoft Graph API rate limits
* **Caching**: Implement appropriate caching for frequently accessed data

#### Calendar Efficiency

* **Sync Frequency**: Configure optimal calendar synchronization intervals
* **Event Filtering**: Set up filters to process only relevant calendar events
* **Time Zone Handling**: Ensure proper time zone configuration for global organizations

### Next Steps

After successful Outlook Agent configuration:

* **User Training**: Provide training on email and calendar AI features
* **Integration Setup**: Configure integration with existing business workflows
* **Monitoring**: Set up monitoring for agent performance and usage
* **SharePoint Integration**: Consider adding [SharePoint Agent](/for-admins/agents/sharepoint-agent.md) for comprehensive Microsoft 365 integration

### Support and Resources

For assistance with Outlook Agent configuration:

* **Blockbrain Support**: Contact your Customer Success Manager for feature-specific help
* **Microsoft Documentation**: Reference Microsoft Graph API documentation for detailed permission information
* **Azure AD Troubleshooting**: Use Azure AD sign-in logs for authentication diagnostics


---

# 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.en.theblockbrain.ai/for-admins/agents/outlook-agent.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.
