• This email address is being protected from spambots. You need JavaScript enabled to view it.

    Recent items


Today I'm working with a particular error: when I search items that contains the single quote character through the REST API, I receive a bad request error (400 error).

The first steps is to analyze the response from the server:

  • Request: GET'path: OR path:'universo.aspx'&rowlimit=5&selectproperties='Title,Path'
  • Response: Error 400: {"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"'path: OR path:'universo.aspx'\" is not valid."}}}

The problem is the single quote ' character into the query that provide to create a wrong query.

I've tried to encode the URL but this not resolve my problem. The solution is simpler: I need only to add another single quote to resolve my problem ('').

  • Request: GET'path: OR path:''universo.aspx'&rowlimit=5&selectproperties='Title,Path'
  • Response: HTTP/1.1 200 OK
Published in SharePoint