Integrations / Outlook
Outlook
Read, search, draft and send email in Outlook and Microsoft 365 mail through Microsoft Graph.
9 actions
OAuth 2
5 read4 write
Calls graph.microsoft.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "outlook" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
| Scope | Why it is requested |
|---|---|
Mail.Read | Read your email so an assistant can find and summarise messages |
Mail.ReadWrite | Create and edit drafts in your mailbox |
Mail.Send | Send email on your behalf |
User.Read | Identify which Microsoft account you connected |
offline_access | Stay connected without asking you to sign in again |
Actions
Create draftwriteoutlook.create_draftSave a new email as a draft without sending it. Safe way to let an AI prepare a message for the user to review and send.
Needs scope: Mail.ReadWrite
| Input | Type | Description | |
|---|---|---|---|
subject | string | Required | Subject line |
body | string | Required | Message body |
body_type | string | Required | Whether body is plain text or HTML |
to_recipients | array of object | Required | Recipients, each as {emailAddress:{address}} |
cc_recipients | array of object | Optional | Optional cc recipients |
importance | string | Optional | Optional importance |
await setu.execute({
userId: "user_1",
action: "outlook.create_draft",
input: {
"subject": "<subject>",
"body": "<body>",
"body_type": "<body_type>",
"to_recipients": []
},
});Create reply draftwriteoutlook.create_reply_draftCreate a draft reply to the sender of an existing message, optionally with a comment as the reply text. The draft is not sent; use send_draft after review.
Needs scope: Mail.ReadWrite
| Input | Type | Description | |
|---|---|---|---|
message_id | string | Required | ID of the message to reply to |
comment | string | Optional | Reply text placed above the quoted original |
await setu.execute({
userId: "user_1",
action: "outlook.create_reply_draft",
input: {
"message_id": "<message_id>"
},
});Get messagereadoutlook.get_messageRead one message in full: sender, recipients, subject and the body as plain text.
Needs scope: Mail.Read
| Input | Type | Description | |
|---|---|---|---|
message_id | string | Required | Message ID from list_messages or search_messages |
await setu.execute({
userId: "user_1",
action: "outlook.get_message",
input: {
"message_id": "<message_id>"
},
});List messages in a folderreadoutlook.list_folder_messagesList messages in one mail folder, for example the inbox, drafts or sent items, using a folder ID or a well-known name.
Needs scope: Mail.Read
| Input | Type | Description | |
|---|---|---|---|
folder_id | string | Required | Folder ID from list_mail_folders, or a well-known name: inbox, drafts, sentitems, deleteditems, archive, junkemail |
top | integer | Optional | Number of messages to return (1 to 50 is sensible; default 10) |
filter | string | Optional | Optional OData $filter, for example: isRead eq false |
await setu.execute({
userId: "user_1",
action: "outlook.list_folder_messages",
input: {
"folder_id": "<folder_id>"
},
});List mail foldersreadoutlook.list_mail_foldersList the top-level mail folders with their IDs and unread counts. Use a folder ID with list_folder_messages.
Needs scope: Mail.Read
| Input | Type | Description | |
|---|---|---|---|
top | integer | Optional | Maximum number of folders to return (default 10) |
await setu.execute({
userId: "user_1",
action: "outlook.list_mail_folders",
input: {},
});List messagesreadoutlook.list_messagesList recent messages across the whole mailbox (newest first by default), with sender, subject, preview and read state. Optionally filter with an OData $filter such as isRead eq false.
Needs scope: Mail.Read
| Input | Type | Description | |
|---|---|---|---|
top | integer | Optional | Number of messages to return (1 to 50 is sensible; default 10) |
filter | string | Optional | Optional OData $filter, for example: isRead eq false |
await setu.execute({
userId: "user_1",
action: "outlook.list_messages",
input: {},
});Search messagesreadoutlook.search_messagesSearch the mailbox by keyword across sender, subject and body (Microsoft search syntax, for example: pizza or from:adele). Results are sorted by sent date.
Needs scope: Mail.Read
| Input | Type | Description | |
|---|---|---|---|
query | string | Required | Search text, for example: invoice or from:adele |
top | integer | Optional | Number of messages to return (1 to 50 is sensible; default 10) |
await setu.execute({
userId: "user_1",
action: "outlook.search_messages",
input: {
"query": "<query>"
},
});Send draftwriteoutlook.send_draftSend an existing draft message (a new draft or a reply draft) to its recipients. This cannot be undone once delivered.
Needs scope: Mail.Send
| Input | Type | Description | |
|---|---|---|---|
message_id | string | Required | ID of the draft from create_draft or create_reply_draft |
await setu.execute({
userId: "user_1",
action: "outlook.send_draft",
input: {
"message_id": "<message_id>"
},
});Send emailwriteoutlook.send_mailSend a new email from the connected Outlook account immediately. It is saved in Sent Items unless disabled. Use create_draft instead to prepare a message for review.
Needs scope: Mail.Send
| Input | Type | Description | |
|---|---|---|---|
subject | string | Required | Subject line |
body | string | Required | Message body |
body_type | string | Required | Whether body is plain text or HTML |
to_recipients | array of object | Required | Recipients, each as {emailAddress:{address}} |
cc_recipients | array of object | Optional | Optional cc recipients |
bcc_recipients | array of object | Optional | Optional bcc recipients |
save_to_sent_items | boolean | Optional | Set false to skip saving a copy in Sent Items (default true) |
await setu.execute({
userId: "user_1",
action: "outlook.send_mail",
input: {
"subject": "<subject>",
"body": "<body>",
"body_type": "<body_type>",
"to_recipients": []
},
});