Nick9one1
Nick9one1

Reputation: 5

graph api escaping apostrophes

I'm trying to make a graph call with a filter to return this item

    "name": "Students'-Cook-Off-at-Exeter-and-Creative-Leftovers.aspx",

My call looks like this

https://graph.microsoft.com/beta/sites/{siteId}/pages/microsoft.graph.sitePage?filter=name eq 'Students%27-Cook-Off-at-Exeter-and-Creative-Leftovers.aspx'

I have tried various versions of encoding the apostrophe, replacing it with double '' and %27%27 but all fail.

the single ' returns a syntax error, and double '' returns nothing.

Upvotes: 1

Views: 35

Answers (1)

user2250152
user2250152

Reputation: 20788

Single quotes must be double escaped. Check the doc:

https://learn.microsoft.com/en-us/graph/query-parameters?view=graph-rest-1.0&tabs=http#escaping-single-quotes

/beta/sites/{siteId}/pages/microsoft.graph.sitePage?filter=name eq 'Students''-Cook-Off-at-Exeter-and-Creative-Leftovers.aspx'

Upvotes: 0

Related Questions