To triage a shared mailbox with Power Automate, start a flow with the Office 365 Outlook trigger "When a new email arrives in a shared mailbox (V2)", pass the subject and body to an AI Builder "Run a prompt" action that returns one category label, and then use a Switch to move, forward or reply to the message according to that label. Send anything the prompt cannot classify to a person, and review results before you automate more.
Who this is for and what you will have
This guide is for IT and operations teams that receive requests in a shared mailbox such as [email protected] and want to sort them into queues without reading each one first. By the end you will have a working flow design with a fixed category list, routing, a human review path and a list of the limits and errors you are likely to meet.
The pattern uses the standard Outlook connector and a prompt. Check the licence and availability notes in the prerequisites before you build, because prompts are limited to some regions and can be throttled.
Prerequisites
- A Microsoft 365 shared mailbox, and an account that is a member of it. Microsoft documents that the account used by the connection must be a member of the shared mailbox.
- Permissions that have replicated. After you grant access, Microsoft says it can take about two hours to replicate.
- Access to Power Automate and to AI Builder prompts. Microsoft notes that prompts run on GPT models powered by Azure OpenAI Service, that the capability is limited to some regions, and that it might be subject to usage limits or capacity throttling.
- A licence that covers AI Builder credits. Power Automate Premium and Process licences each include 5,000 AI Builder credits per month according to Microsoft's licence table, and prompt usage consumes credits. See Power Automate Licensing: Premium Connectors Explained for how licences map to flows.
- The shared mailbox address, not an Office 365 group address. Microsoft states that a group address cannot be used as a shared mailbox address.
Design the categories first
A classifier is only as good as its label list. Decide the categories before you write a prompt, and keep the list short and mutually exclusive. For example:
| Label | Meaning | Route |
|---|---|---|
billing | Invoices, payments, refunds | Billing team mailbox |
access | Password, account, permissions | Service desk folder |
incident | Something is broken or down | Service desk, flagged |
sales | Quotes and new enquiries | Sales mailbox |
other | Anything else or unclear | Human review |
Always include an other label. It gives the model a safe answer when the message does not fit, and it gives your flow a path that does not guess.
Create the prompt
AI Builder prompts are created in the Power Automate portal:
- Sign in to Power Automate.
- Select AI hub > Prompts > Build your own prompt.
- Name the prompt, for example
Mailbox triage. - Write the instruction, then add an input by typing
/or selecting Add content and choosing Text. Give the input a name such asEmailText. - Enter a sample value for the input and select Test.
- Select Save when the result is what you expect.
Microsoft describes a prompt as an instruction plus context, and says a good prompt is clear, specific, contextual and relevant. A prompt for triage might read as follows, with the input placed where the email text belongs:
You classify emails sent to a company support mailbox.
Choose exactly one label from this list: billing, access, incident, sales, other.
Answer with the label only, in lowercase, with no punctuation or explanation.
If the email does not clearly fit one label, answer other.
Email:
[EmailText]In the editor you insert EmailText as an input object rather than typing the brackets. Test the prompt with at least one example for every label, including an ambiguous message that should return other.
Build the flow
Step 1: Add the trigger
- Select + Create > Automated cloud flow.
- Choose the Office 365 Outlook trigger When a new email arrives in a shared mailbox (V2).
- Set Original Mailbox Address to the shared mailbox address, for example
[email protected].
The trigger has optional filters that cut cost and noise before the AI step runs:
| Parameter | Use |
|---|---|
| Folder | The folder to watch. The trigger only checks the folder you configure |
| From, To, CC, To or CC | Run only when these addresses match |
| Importance | Any, High, Normal or Low |
| Only with Attachments | Skip messages with no attachment when true |
| Include Attachments | Include attachment content in the trigger output |
| Subject Filter | Text to find in the subject line |
Leave Include Attachments off unless the prompt needs them, because larger payloads slow the flow.
Step 2: Run the prompt
- Add a new step and search for Run a prompt.
- In Prompt, choose
Mailbox triage. - In the input field, use dynamic content from the trigger to build the text, for example the subject followed by the body.
Microsoft notes that since May 2025 the action is called Run a prompt, replacing the earlier Create text with GPT using a prompt. Its output is available as a variable for later steps.
Step 3: Route with a Switch
Add a Switch control on the prompt's text output, with one case for each label and a default case.
| Case | Action |
|---|---|
billing | Send an email from a shared mailbox (V2) or forward to the billing team |
access | Move email (V2) to a service desk folder |
incident | Flag email (V2), then move to an incident folder |
sales | Notify the sales mailbox |
| Default | Start a human review, described below |
The documented parameters for the actions you are likely to use:
- Move email (V2) needs Message Id and Folder, and takes Original Mailbox Address for the shared mailbox to move mail from.
- Send an email from a shared mailbox (V2) needs Original Mailbox Address, To, Subject and Body. Microsoft notes that your account needs permission to access the mailbox, that it works only for Microsoft 365 shared mailboxes, and that it does not work for shared mailboxes converted from personal mailboxes.
- Reply to email (V3) needs Message Id, and you set Original Mailbox Address to reply from the shared mailbox. It does not support encrypted emails.
- Flag email (V2) needs Message Id and accepts Original Mailbox Address and Flag Status.
For each action that works on the shared mailbox, set Original Mailbox Address explicitly. Otherwise the action may act on the connection account's own mailbox.
Add human review for uncertain mail
Microsoft documents a pattern for human review of prompt output. After the Run a prompt card, add the Approvals action Start and wait for an approval of text, set the Title, put the prompt's text output in Suggested Text, and put an email address in Assigned To. Add a Condition on Outcome that tests for Approve, and take the next action only in the true branch. Reviewers see the request under Approvals > Received in the Power Automate portal, where they can edit the text and confirm.
For triage, the useful variation is to use this only in the default case and for sensitive labels such as incident, so the AI handles routine mail and a person sees anything unusual. See Power Automate Approval Workflow with SharePoint for more on approvals.
Limits and behaviour to know about
Microsoft documents several limits for the Outlook connector and this trigger:
| Limit | Value |
|---|---|
| API calls per connection | 300 per 60 seconds |
| Maximum mail content length | 49 MB |
| Concurrent requests | 70 |
| Concurrent megabytes transferred | 300 MB |
Office also enforces per-inbox limits, which you can reach when several flows target the same inbox. Behaviours of the trigger that catch people out:
- It is based on the received date and time. Moving an email does not change that value, so emails received before the last successful run can be skipped.
- It checks only the configured folder, so if a mailbox rule moves mail out of the Inbox, select the correct folder.
- It may intermittently trigger for older emails moved into a folder. Microsoft says this is by design.
- You need a separate flow for each mailbox you want to monitor.
- It does not work for user-to-user shared mailboxes unless one user has full access, not only send permission, to the other mailbox.
Test and measure
- Send one test message for each label to the shared mailbox.
- Open the flow's run history and confirm the prompt output and the branch taken for each.
- Check what happens for a blank body, a long thread and a message in another language.
- Keep a spreadsheet or list of a few weeks of messages, the label the flow gave and the label a person would give, and compare them before you let the flow move or reply to mail unattended.
For failure handling around the AI step, see Power Automate Error Handling with Try-Catch Scopes, and for general run failures see Power Automate Flow Failed: Troubleshooting.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Trigger never fires | Wrong folder, a rule moved the mail, or permissions not yet replicated | Select the right folder and wait about two hours after granting access |
| "Specified object was not found in the store" | The message was moved or deleted, or the connection is stale | Delete the Outlook connection and create a new one |
| Action acts on the wrong mailbox | Original Mailbox Address left blank | Set it on every shared mailbox action |
| Run a prompt unavailable | Region limit, licence, or capacity throttling | Check AI Builder availability and credits |
| Output includes extra words | Prompt allows explanations | Tighten the prompt to one lowercase label and add a default case |
| Duplicate processing of old mail | Moved emails can re-trigger by design | Track processed message IDs or categorise on completion |
Checklist
- Categories fixed, short and mutually exclusive, with an
otherlabel. - Prompt tested with an example of every label and an ambiguous message.
- One flow per shared mailbox, with the correct folder and Original Mailbox Address.
- Connection account is a member of the shared mailbox.
- Default branch goes to a person, and Approvals review is in place for sensitive labels.
- AI Builder credits and regional availability confirmed.
- Results compared with human labels before automatic moves or replies.
References
- Office 365 Outlook connector reference: https://learn.microsoft.com/en-us/connectors/office365/
- Use your prompt in Power Automate: https://learn.microsoft.com/en-us/ai-builder/use-a-custom-prompt-in-flow
- Create a prompt: https://learn.microsoft.com/en-us/microsoft-copilot-studio/create-custom-prompt
- Types of Power Automate licenses: https://learn.microsoft.com/en-us/power-platform/admin/power-automate-licensing/types
Comments
Questions and tips are welcome. Comments are checked by the EpiFive team before they appear; please do not share passwords, phone numbers or other private details.