Copilot Studio Agent with outlook connector

류재욱 25 Reputation points
2026-06-05T02:11:28.8333333+00:00

Hello,

I am struggling with building an agent which helps user finding their Outlook email from the Inbox.

I've added o365 outlook connector (get email(v3)), set input as 'search_query',

but when i ask agent "find me the most recent email from ******@in4uclouud.com", it cannot find from Inbox and or finds only from other folder beside Inbox.

i thought this would be easy to build but cannot find the reason why this is failing...

does anyone know what could be the reason or how to build the proper mail searcher agent?

p.s. i've already got M365 Copilot Studio license

Thank you for your help!

Microsoft Copilot | Other
0 comments No comments

Answer accepted by question author
William Edwards 165 Reputation points
2026-06-05T02:40:13.1633333+00:00

The issue here is a fundamental mismatch between natural language and the API query language that the Outlook connector uses under the hood.

When you pass the agent's dynamic string directly into the Get emails (V3) connector, Copilot is likely passing the user's entire raw sentence ("find me the most recent...") into the Search Query field. The Outlook API does not process natural language. It expects rigid KQL (Keyword Query Language) syntax. When you feed it a full sentence, the API parses it as a massive "OR" search, pulling random garbage from Archive, Sent, or Deleted folders simply because those emails contain common words like "find" or "recent."

To fix this, you must physically bridge the gap between the AI's natural language and the API's hard syntax:

  • Constrain the AI's Extraction: Instead of a generic search_query input, rename your input variable to sender_email. In the input's description box, explicitly instruct the AI: "Extract only the exact email address from the user's prompt."
  • Hardcode the KQL Prefix: In the Get emails (V3) action setup, go to the Search Query field and physically type from: followed immediately by your dynamic sender_email variable (so the final execution reads exactly like from:******@in4uclouud.com).
  • Lock the Folder Path: Click the Folder dropdown in the action and physically select Inbox. Do not leave this as an AI-populated variable. The AI does not know your tenant's internal Exchange Folder IDs, and if it guesses, the connector will default to searching the entire mailbox tree.
  • Limit the Array: Set the Top or Fetch parameter to 1 so the array only returns the absolute most recent hit.

Are you adding this connector natively as a Copilot Studio Plugin Action, or are you routing the logic through a Power Automate Cloud Flow?

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.