The graph API search does not work when the site title contains a special character.

Guillaume Gouge 5 Reputation points
2023-06-26T12:59:10.46+00:00

I have two Sharepoints in my tenant named "Suspens !" and "devops Workspace".

In both Sharepoint I have a file named "Test.docx"

I tried to run the following request on each Sharepoint :

https://graph.microsoft.com/v1.0//drives/<myDriveId>/items/root/microsoft.graph.search(q='Test')

On the tenant "Suspens !" the graph API returns an empty list, on the tenant "devops Workspace" the document is present.

I can reproduce this behaviour on any sharepoint that has a special character in its name.

How can I search in a sharepoint that has a special character in its name ?

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mehtab Siddique (MINDTREE LIMITED) 971 Reputation points
    2023-06-27T11:07:58.5533333+00:00

    Hi @Guillaume Gouge,

    As mentioned in the document special characters must be URL encoded while using the search query.

    User's image

    For URl encoding:https://learn.microsoft.com/en-us/dotnet/api/system.web.util.httpencoder.urlencode?view=netframework-4.8


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.