> For the complete documentation index, see [llms.txt](https://docs.graphlit.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graphlit.dev/api-guides/use-cases/feeds/messaging/feed-create-outlook-email.md).

# Create Outlook Email Feed

## User Intent

"How do I sync Outlook/Microsoft 365 email? Show me Outlook email feed configuration."

## Operation

**SDK Method**: `createFeed()` with FeedTypes.Email\
**Auth**: Microsoft OAuth tokens

***

## Code Example (TypeScript)

```typescript
import { Graphlit } from 'graphlit-client';
import { FeedTypes, FeedServiceTypes, EmailListingTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

const feed = await graphlit.createFeed({
  name: 'Outlook Inbox',
  type: FeedTypes.Email,
  email: {
    type: FeedServiceTypes.MicrosoftEmail,
    microsoft: {
      type: EmailListingTypes.Past,
      clientId: process.env.MICROSOFT_CLIENT_ID!,
      clientSecret: process.env.MICROSOFT_CLIENT_SECRET!,
      refreshToken: process.env.MICROSOFT_REFRESH_TOKEN!,
      readLimit: 100,
      inboxOnly: true,
      excludeSentItems: true
    },
    includeAttachments: true,
  },
  // Optional: add workflow for content processing
  // workflow: { id: workflow.createWorkflow.id }
});

console.log(`Created Outlook feed: ${feed.createFeed.id}`);
```

***

## Configuration

**type**: `EmailListingTypes.Past` or `EmailListingTypes.New`\
**readLimit**: Number of emails to sync\
**inboxOnly**: Only sync inbox folder\
**excludeSentItems**: Exclude sent messages\
**includeSpam**: Include junk folder (default: false)\
**includeDeletedItems**: Include deleted items (default: false)\
**includeAttachments**: Download email attachments\
**filter**: OData filter query

***

## Microsoft OAuth Setup

1. Register app in Azure Portal
2. Add Microsoft Graph API permissions (`Mail.Read`)
3. Create client secret
4. Configure redirect URI
5. Get refresh token via OAuth flow

***

## What Gets Synced

* Email subject, body, and headers
* Sender and recipient information
* Timestamps and folder names
* Attachments (if enabled)
* Conversation threads

***

## Filtering Examples

**By sender**:

```typescript
filter: "from/emailAddress/address eq 'user@example.com'"
```

**By date**:

```typescript
filter: "receivedDateTime ge 2024-01-01T00:00:00Z"
```

**With attachments**:

```typescript
filter: "hasAttachments eq true"
```

**Unread only**:

```typescript
filter: "isRead eq false"
```

***

## Related

* [Gmail Feed](/api-guides/use-cases/feeds/messaging/feed-create-gmail.md) - Google email
* [Outlook Calendar Feed](/api-guides/use-cases/feeds/calendars/feed-create-outlook-calendar.md) - Microsoft calendar
* [Microsoft Teams Feed](/api-guides/use-cases/feeds/messaging/feed-create-microsoft-teams.md) - Teams messaging
