dusk bot
integrationsquery emails in a folder

dusk botintegrationsoutlook

pull the outlook mail that meets a precise condition

get the unread attachment queue without moving a single email. a bot queries an outlook folder for unread mail, attachments, a sender or other properties.

by the dusk bot team · checked · how we made this

ask for the details and order your report needs. dusk classes this query as a change even though it reads mail. allow the query and folder reads with read and write access, keeping mailbox edits disabled.

pixel art: a cyan pixel bot and an orange pixel bot beside the Outlook mark on a white tile, a mailbox with a letter and a magnifying glass, on a grassy meadow in front of little green islands on a lake, one saying "find the unread attachments"

what it does

conditions beat a vague search when you need a repeatable list. choose one folder and the properties that matter. the bot can return just the details your report needs. built-in folders like inbox work by name; custom folders need a lookup first.

  • the default request covers up to 100 messages
  • each batch can hold at most 1,000
  • large results need more batches
  • if microsoft rejects sorting, the bot sorts the returned mail and tells you

when you would use it

  • find unread intake mail with attachments. keep the report inside the named folder.
  • read urgent inbox messages. leave them where they are.
  • see who sent invoices this month. ask for senders and subjects from that folder.
  • clear up who owes the shared team a reply. the connected account must already have access.

try it

paste this into a chat with your bot

every monday and thursday at 14:10, find my custom outlook folder intake. query it for unread messages with attachments. keep fetching until every matching message is included. list sender, subject and received time here, in received-time order. say if you sorted the results yourself. never mark mail read, move messages, open attachments or send replies.
when
mondays and thursdays at 14:10
needs
outlook connected with read and write limited to query emails and folder reads; the account must have access to intake

what comes back looks like this (an example)

intake attachment queue
- saskia, amber finch studio: reference photographs, monday 09:12.
- cedric, river desk: purchase request, monday 10:36.
sorted by time received. mail unchanged.

set it up

  1. connect outlook with read and write. limit the bot to query emails and folder reads.
  2. name one folder. let the bot find custom folders first.
  3. try a small query. compare the matches with your folder and read their received times.
  4. schedule it once the matches look right. open run history in automations to find each report.

what it needs from you

inputrequiredwhat it is
topnoMaximum number of messages to return per request (1-1000).
skipnoNumber of messages to skip for pagination.
filterno$51
foldernoSINGLE mail folder to search within (cannot search across all folders).
selectnoList of message properties to include in the response (accepts comma-separated string or list).
orderbynoSort order as comma-separated string or list (accepts 'field asc/desc' format or JSON-serialized arrays).

from composio's catalog for Outlook (action OUTLOOK_QUERY_EMAILS, read 12 november 20264). your bot fills these in from what you tell it.

how dusk bot handles it

dusk bot counts Query Emails as a change: it alters something in Outlook, and the sending setting does not cover it. a bot you allow only to read can never call it.

the permissions Outlook asks for to run it: Mail.ReadBasic, Mail.Read, Mail.ReadWrite, Mail.Read.Shared.

where it stops

  • one query covers one folder. use separate queries for several locations.
  • big folders come back in batches. read all results before calling the list complete.
  • ask it to sort the mail it gets. microsoft can reject the requested order as too costly; the bot should tell you and sort locally.
  • shared mail still needs access. the bot can't read a mailbox your account cannot open.

try it in 2 minutes

  1. name a single outlook folder
  2. allow query emails and folder reads only
  3. ask for unread messages with attachments
  4. match the folder, total results and received-time order

mistakes people make

calling the first 100 messages the whole queue

ask it to keep reading until it has every matching result.

granting every mailbox action for a report

allow this query and the folder reads it needs.

before you call the queue complete

  • the bot found the intended folder
  • the conditions match your question
  • all matching results appear
  • the received times run in the requested order

questions

why does a mail query need a write grant in dusk?

dusk classifies this action as a change. it still reads mail. allow the query and folder reads specifically, keeping unrelated mailbox edits out.

can it query a folder called supplier returns?

yes. it finds the custom folder first. built-in names such as inbox work directly.

will it always return the newest email first?

no. microsoft can reject the requested order. the query can continue without sorting. ask the bot to say so and sort the returned results itself.

sources

  1. dusk bot docs: files and apps
  2. dusk bot docs: routines
  3. dusk bot docs: a bot's computer
  4. composio, Outlook toolkit (catalog version 20261104_00), checked 12 november 2026

drafted with ai help from the dusk bot docs and the sources listed on this page, then checked against them. if something here is wrong or out of date, write to [email protected].