Microsoft-graph-docs: Which are the allowed characters for `{search-query}`?

Created on 18 Feb 2019  Â·  4Comments  Â·  Source: microsoftgraph/microsoft-graph-docs

Hello,

I am experiencing hard times with the /drive/*/search endpoint. In particular, I can see that a search-query containing / causes a 400 BadRequest exception. It doesn't matter whether the / is sent as-is or urlencoded (%2F).

I am puzzled by the error code returned (400 BadRequest -- I would be expecting a more specific error code) and by the doubt: are there many more characters that make this endpoint explose? Could you please list these characters in the documentation?

If there's a way to send the / to the endpoint, which should be the format to do that?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Most helpful comment

I also think the syntax of the search text is unclear. I noticed. With OneDrive Personal, I can run with the search text below. The result is also correct that.

https://graph.microsoft.com/v1.0/me/drive/root/search(q='*.xlsx ')

In OneDrive Business, if there is a "*" in the search text, a 400 error will occur.

The documentation needs to be improved. There is not enough information.

All 4 comments

Are you trying to search for something like q='/subfolder1/subfolder2/item name' ? That is not possible I think because the item that is searched for in the complete drive. So if you want to search for 'Apple' in the fruit folder you have several options:

1) search for 'Apple' in the root folder and it should popup with a parent reference to it ( to fruit )
2) go to the fruit folder and do a query in there.

both should have similar results.

It could just be a document which includes "Accounts / Payable" in its content or title. So this character should just be stripped from the query entered by the user, I guess.

Since the documentation doesn't mention which characters are raising 400 http statuses, could we have a more detailed list of which characters should be stripped from the query?

I also think the syntax of the search text is unclear. I noticed. With OneDrive Personal, I can run with the search text below. The result is also correct that.

https://graph.microsoft.com/v1.0/me/drive/root/search(q='*.xlsx ')

In OneDrive Business, if there is a "*" in the search text, a 400 error will occur.

The documentation needs to be improved. There is not enough information.

I am looking to use the drive item search to get all .xlsx and .xlsm files. I noticed that with OneDrive Personal, I can get results for the the below query

https://graph.microsoft.com/v1.0/me/drive/search(q='.xlsx+or+.xlsm')

However for OneDrive Business the above query does not work. IN order to get results for OneDrive Business the following query returns results

https://graph.microsoft.com/v1.0/me/drive/search(q='.xlsx+OR+.xlsm')

The only difference in both the queries is the case for the 'OR'. Is this expected behaviour?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joostvdlinden picture joostvdlinden  Â·  4Comments

dagexiongfeng picture dagexiongfeng  Â·  4Comments

andrewfabrizi picture andrewfabrizi  Â·  3Comments

findyoucef picture findyoucef  Â·  4Comments

Chotimir picture Chotimir  Â·  3Comments