Skip to content

Mailbox Query does not properly escape quote symbols #1133

@harryoui

Description

@harryoui

The above query that contains a ' symbol in the subject filter:
query = mailbox.new_query().on_attribute('subject').contains("who's the best?")
Fails with:
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/users/.../messages?%24top=1&%24filter=contains%28subject%2C+%27who%27s+the+best%3F%27%29 | Error Message: Invalid filter clause: ')' or ',' expected at position 23 in 'contains(subject, 'who's the best?')'.

To properly escape single quotes in ms graph, they must be entered twice ( ' --> '' ):
query = mailbox.new_query().on_attribute('subject').contains("who''s the best?")

I'm unsure if this issue includes other characters that also need to be escaped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions