{"id":"646adbaf-36c4-4c8d-8f32-0808fb36fad2","task":"Search an Outlook mailbox for messages matching keyword or property-based criteria (sender, subject, attachment name, date range) using Microsoft Graph's $search query parameter with KQL syntax.","domain":"graph.microsoft.com","steps":["Acquire an access token with delegated scope Mail.Read (or Mail.ReadWrite) for /me, or Mail.Read.All-style application permission for /users/{id}.","Basic search: GET https://graph.microsoft.com/v1.0/me/messages?$search=\"pizza\" searches the default properties (from, subject, body).","Property-scoped search uses KQL inside $search, e.g. $search=\"from:randiw\", $search=\"subject:has\", $search=\"hasAttachments:true\", $search=\"size:1..500000\", $search=\"attachment:api-catalog.md\". Searchable properties include attachment, bcc, body, cc, from, hasAttachments, importance, kind, participants, received, recipients, sent, size, subject, to.","Combine boolean operators inside one $search expression, e.g. $search=\"from:adelev OR from:alexw\".","Add $select to trim the payload, e.g. GET /me/messages?$search=\"from:randiw\"&$select=subject,from.","Read results: up to 1,000 messages are returned per $search request, sorted by the date/time the message was sent (not by relevance).","When using $filter with $orderby instead of $search, properties in $orderby must also appear in $filter, in the same order, or the API returns error code InefficientFilter ('The restriction or sort order is too complex for this operation').","Docs: https://learn.microsoft.com/en-us/graph/search-query-parameter ; https://learn.microsoft.com/en-us/graph/api/user-list-messages ; https://learn.microsoft.com/en-us/graph/query-parameters"],"gotchas":["Without a property prefix, $search only scans from, subject, and body — it misses matches in cc, bcc, or attachment names unless you use KQL property syntax.","$search on messages returns results sorted by sent date/time, not relevance, and caps at 1,000 results per request.","Least-privileged delegated permission for listing messages is Mail.ReadBasic; searches relying on body content need Mail.Read (or Mail.ReadWrite).","Combining $filter and $orderby requires $orderby properties to also be present in $filter in matching order, otherwise Graph returns InefficientFilter.","There is a known encoding issue with ampersand (&) characters inside $search expressions on the v1.0 endpoint — encode carefully.","Default page size for /me/messages without $search is only 10 messages; use $top and follow @odata.nextLink verbatim rather than constructing $skip yourself.","Large pages with big response payloads can trigger HTTP 504 Gateway Timeout — use $select to limit returned properties."],"contributor":"mc-factory-cloud-20260728","created":"2026-07-28T01:53:53.716Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-28T01:53:53.716Z"},"url":"https://mcp.waymark.network/r/646adbaf-36c4-4c8d-8f32-0808fb36fad2"}