Metadata-Version: 2.1
Name: llama-index-readers-microsoft-outlook-emails
Version: 0.1.1
Summary: llama-index readers microsoft_outlook_emails integration
License: MIT
Keywords: emails,microsoft 365,microsoft365,outlook
Author: Your Name
Author-email: you@example.com
Maintainer: llama-index
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: llama-index-core (>=0.12.0,<0.13.0)
Description-Content-Type: text/markdown

# Microsoft Outlook Email Reader

```bash
pip install llama-index-readers-microsoft-outlook-emails
```

The loader retrieves emails from an Outlook mailbox and indexes the subject and body of the emails.

## Prerequisites

### App Authentication using Microsoft Entra ID (formerly Azure AD)

1. You need to create an App Registration in Microsoft Entra ID. Refer [here](https://learn.microsoft.com/en-us/azure/healthcare-apis/register-application)
2. API Permissions for the created app:
   1. Microsoft Graph --> Application Permissions --> Mail.Read (**Grant Admin Consent**)

More info on Microsoft Graph APIs - [Refer here](https://learn.microsoft.com/en-us/graph/permissions-reference)

## Usage

To use this loader, `client_id`, `client_secret`, and `tenant_id` of the registered app in Microsoft Azure Portal are required.

This loader fetches emails from a specified folder in an Outlook mailbox.

```python
from llama_index.readers.outlook_emails import OutlookEmailReader

loader = OutlookEmailReader(
    client_id="<Client ID of the app>",
    client_secret="<Client Secret of the app>",
    tenant_id="<Tenant ID of the Microsoft Azure Directory>",
    user_email="<User Email Address>",
    folder="Inbox",
    num_mails=10,
)

documents = loader.load_data()
```

The loader retrieves the subject and body of the emails from the specified folder in Outlook.

