Maton

Outlook

Access the Microsoft Outlook API (via Microsoft Graph) with managed OAuth authentication. Read, send, and manage emails, folders, calendar events, and contacts.

Reference

User Profile

GET /outlook/v1.0/me
maton outlook whoami

List Mail Folders

GET /outlook/v1.0/me/mailFolders
maton outlook folder list

Get Mail Folder

GET /outlook/v1.0/me/mailFolders/{folderId}
maton outlook folder view {folderId}

Well-known folder names: Inbox, Drafts, SentItems, DeletedItems, Archive, JunkEmail

Create Mail Folder

POST /outlook/v1.0/me/mailFolders
Content-Type: application/json

{
  "displayName": "My Folder"
}
maton outlook folder create --name "My Folder"

Delete Mail Folder

DELETE /outlook/v1.0/me/mailFolders/{folderId}
maton outlook folder delete {folderId}

List Child Folders

GET /outlook/v1.0/me/mailFolders/{folderId}/childFolders
maton outlook folder list --parent {folderId}

List Messages

GET /outlook/v1.0/me/messages
maton outlook message list

From specific folder:

GET /outlook/v1.0/me/mailFolders/Inbox/messages
maton outlook message list --folder Inbox

With query filter:

GET /outlook/v1.0/me/messages?$filter=isRead eq false&$top=10
maton outlook message list --filter "isRead eq false" --top 10

Get Message

GET /outlook/v1.0/me/messages/{messageId}
maton outlook message view {messageId}

Create Draft

POST /outlook/v1.0/me/messages
Content-Type: application/json

{
  "subject": "Hello",
  "body": {
    "contentType": "Text",
    "content": "This is the email body."
  },
  "toRecipients": [
    {
      "emailAddress": {
        "address": "recipient@example.com"
      }
    }
  ]
}
maton outlook message draft --to recipient@example.com --subject "Hello" --body "This is the email body."

Send Message

POST /outlook/v1.0/me/sendMail
Content-Type: application/json

{
  "message": {
    "subject": "Hello",
    "body": {
      "contentType": "Text",
      "content": "This is the email body."
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "recipient@example.com"
        }
      }
    ]
  },
  "saveToSentItems": true
}
maton outlook message send --to recipient@example.com --subject "Hello" --body "This is the email body."

Send Existing Draft

POST /outlook/v1.0/me/messages/{messageId}/send
maton outlook message send {messageId}

Update Message

PATCH /outlook/v1.0/me/messages/{messageId}
Content-Type: application/json

{
  "isRead": true
}
maton outlook message update {messageId} --read

Delete Message

DELETE /outlook/v1.0/me/messages/{messageId}
maton outlook message delete {messageId}

Move Message

POST /outlook/v1.0/me/messages/{messageId}/move
Content-Type: application/json

{
  "destinationId": "{folderId}"
}
maton outlook message move {messageId} --to {folderId}

Search Messages

maton outlook message search "quarterly report"

List Calendars

GET /outlook/v1.0/me/calendars
maton outlook calendar list

List Events

GET /outlook/v1.0/me/calendar/events
maton outlook event list

With date filter:

GET /outlook/v1.0/me/calendar/events?$filter=start/dateTime ge '2024-01-01'&$top=10
maton outlook event list --filter "start/dateTime ge '2024-01-01'" --top 10

Get Event

GET /outlook/v1.0/me/events/{eventId}
maton outlook event view {eventId}

Create Event

POST /outlook/v1.0/me/calendar/events
Content-Type: application/json

{
  "subject": "Meeting",
  "start": {
    "dateTime": "2024-01-15T10:00:00",
    "timeZone": "UTC"
  },
  "end": {
    "dateTime": "2024-01-15T11:00:00",
    "timeZone": "UTC"
  },
  "attendees": [
    {
      "emailAddress": {
        "address": "attendee@example.com"
      },
      "type": "required"
    }
  ]
}
maton outlook event create --subject "Meeting" --start 2024-01-15T10:00:00 --end 2024-01-15T11:00:00 --timezone UTC --attendees attendee@example.com

Delete Event

DELETE /outlook/v1.0/me/events/{eventId}
maton outlook event delete {eventId}

List Contacts

GET /outlook/v1.0/me/contacts
maton outlook contact list

Get Contact

GET /outlook/v1.0/me/contacts/{contactId}
maton outlook contact view {contactId}

Create Contact

POST /outlook/v1.0/me/contacts
Content-Type: application/json

{
  "givenName": "John",
  "surname": "Doe",
  "emailAddresses": [
    {
      "address": "john.doe@example.com"
    }
  ]
}
maton outlook contact create --given-name John --surname Doe --email john.doe@example.com

Delete Contact

DELETE /outlook/v1.0/me/contacts/{contactId}
maton outlook contact delete {contactId}

Resources

On this page