question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mailbox - can't query message "body"

See original GitHub issue

Though subject is easy to query, I don’t see any documented way to query the message body. The obvious approach using mailbox queries does not work. I’ve tried many attributes names for the body, for example:

query = mailbox.new_query('body').contains('word')
query = mailbox.new_query('body_html').contains('word')
query = mailbox.new_query('body_content').contains('word')
query = mailbox.new_query('body/content').contains('word')

All of these attempts return 400 Client Error.

messages = mailbox.get_messages(limit=25, query=query) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/users/(omitted@company.com)?%24top=25&%24filter=contains(body%2C+'change') | Error Message: Invalid filter clause

Is there a different attribute to query, or is this a bug?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
KirbyFearscommented, Apr 15, 2019

Okay this works. I can actually make complex search criteria using AND, OR, NOT operators.

mailbox.new_query().search('body:word AND received>=2019-04-05')

Thank you!

0reactions
janscascommented, Apr 15, 2019

Yep, sorry. The graph search example on “received” field only shows a time-less date. And the format is nonstandard. Seems out of sync with the other microsoft APIs.

Well, you can always filter by code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Search Mail and People in Outlook.com - Microsoft Support
Use Advanced Query Search to refine results ; Body or Content. Searches the message body. Body:report ; Sent. Searches the date sent. You...
Read more >
How to use query for Office 365 Get Mail activity? - Learn
I am trying to retrieve email from Office 365 outlook. I have already got it to retrieve all emails in the specified folder, ......
Read more >
Search for emails in Mail on Mac - Apple Support
Search for emails using Mail suggestions and search filters​​ If there are no results in the current mailbox, click “Search all mailboxes” below...
Read more >
Troubleshooting Database Mail Failures - SQLShack
In this article you will see how to troubleshoot Database Mail Failures which is a convenient and easy way to send alerts, reports, ......
Read more >
Microsoft Graph API returns mail message body as HTML
Headers.Add("outlook.body-content-type", "text"); still doesnt work. Any other way to specify the header?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found