Sync flagged Outlook emails into Microsoft To Do hourly
Every hour during work hours, turn your flagged high-importance Outlook emails into Microsoft To Do tasks so your action list lives in one place.
Build a code workflow that syncs my flagged, high-importance Microsoft Outlook emails into Microsoft To Do as tasks on a recurring schedule, so my action list lives in one place.
Trigger: cron, every hour on the hour during work hours (Monday to Friday, 8am to 6pm in my local time zone). Make the schedule and time zone easy to edit.
Step 1. Call Microsoft Outlook List Messages on my mailbox. Filter for messages where flag/followupFlag status is set (flagStatus eq 'flagged') AND importance eq 'high', ordered by receivedDateTime descending. Use a $filter that also bounds receivedDateTime to the last ~70 minutes so we only look at the most recent batch (the trigger fires every 60 minutes; the 10-minute overlap is intentional for safety). Select the fields we actually need: id, subject, bodyPreview, from, receivedDateTime, webLink, flag (so we can read flag.dueDateTime).
Step 2. Resolve the destination list in Microsoft To Do. Call List Task Lists and look for one named 'Email Follow-ups'. If it does not exist, call Create Task List with displayName 'Email Follow-ups' and use the new id. Cache the list id between runs so we are not creating it repeatedly.
Step 3. Dedupe. Before creating a task for an email, check whether that Outlook message id has already been processed. Use List Tasks on the Email Follow-ups list (recent window, e.g. tasks created in the last 14 days) and inspect each task's linked resources for one whose applicationName is 'Outlook' and externalId matches the message id. If a match exists, skip the message. This is how we avoid duplicate tasks across runs.
Step 4. For each remaining flagged message, call Microsoft To Do Create Task in the Email Follow-ups list with: title = the email subject; body = a plain text/markdown block containing the sender name and address on the first line and the bodyPreview underneath; importance = 'high'; dueDateTime = the flag.dueDateTime when present (carry the timeZone through using the dateTimeTimeZone shape To Do expects).
Step 5. Immediately call Microsoft To Do Create Linked Resource on the newly created task with: webUrl = the Outlook message webLink (so I can tap the task and jump straight back to the email), applicationName = 'Outlook', displayName = the email subject, externalId = the Outlook message id. The externalId is what step 3 uses to dedupe next run.
Error handling: respect Microsoft Graph 429 responses by honoring Retry-After; treat 401 as a re-auth signal; log every skipped duplicate and every created task so I can see what happened in the run history. If a single message fails to convert, keep going and log it; do not abort the whole batch.
Setup inputs to expose: the cron expression and time zone; the destination list name (default 'Email Follow-ups'); a toggle for whether to require high importance or accept any flagged email; an optional sender allowlist (only flagged emails from these addresses become tasks).
Both integrations use the same Microsoft login (Microsoft Graph), so connecting one OAuth account is enough.
Additional information
What does this prompt do?
- Scans your Outlook mailbox each hour during work hours for emails you flagged for follow-up and marked high importance.
- Creates a matching task in a dedicated Email Follow-ups list in Microsoft To Do, with the email subject as the title and the sender plus a preview in the notes.
- Carries the flag due date over to the task due date so anything time-sensitive shows up on the right day.
- Drops a link on each task that opens the original email in Outlook, and skips emails it has already turned into tasks so your list stays clean.
What do I need to use this?
- A Microsoft 365 account with Outlook (work or personal).
- A Microsoft To Do account on the same Microsoft login.
- A habit of flagging the emails you actually want to act on, and optionally marking them high importance.
How can I customize it?
- Change the schedule (every 30 minutes, every two hours, only at 9am and 1pm) or the work-hours window.
- Loosen or tighten the filter, for example include any flagged email regardless of importance, or only flagged emails from specific people.
- Rename the destination list or point it at an existing To Do list you already use for follow-ups.
Frequently asked questions
Will this create duplicate tasks for the same email?
Do I have to mark emails high importance to get a task?
Where do the tasks show up in Microsoft To Do?
Can I jump from the task back to the original email?
Does the flag's due date carry over?
Stop juggling flagged emails and a separate task list.
Connect Outlook and Microsoft To Do once, and Geni keeps your follow-up list in sync every hour during work hours.