0
votes

I'm getting a 400 error when trying to do a search both through the Graph Explorer and through my own code. Both worked a few weeks ago but have stopped working recently. Another developer has been able to replicate it in their Tenancy, but Microsoft will not provide me support as we are not a Premier Customer.

If I run this query:

https://graph.microsoft.com/v1.0/drives{drive_id}/root/ 

it succeeds and returns information about the drive.

Following the documentation at https://docs.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http a search can be used via

https://graph.microsoft.com/v1.0/drives/{drive-id}/root/search(q='foobar')

But this returns a 400 error with "One of the provided arguments is not acceptable."

However, if I search for items in our entire Tenancy via the group search it succeeds so it doesn't appear to be a permissions error, but is not a viable solution as I need to search a particular drive.

1

1 Answers

0
votes

please confirm whether you are still facing the issue. I was not able to reproduce the same from my side.

I ran this query: https://graph.microsoft.com/v1.0/me/drives/drive-id/root/Search(q='Practices Checker')

And was able to get the desired result as below:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(driveItem)",
    "value": [
        {
            "@odata.type": "#microsoft.graph.driveItem",
            "createdDateTime": "2020-12-09T11:55:47Z",
            "id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "lastModifiedDateTime": "2020-11-03T06:51:27Z",
            "name": "Practices Checker",
            "webUrl": "https://microsoftapc-my.sharepoint.com/personal/ribera_xxxxxxxx_com/Documents/Documents/Practices%20Checker",
            "size": 0,
            "createdBy": {
                "user": {
                    "email": "ribera@xxxxxxxxxx.com",
                    "displayName": "Rinki Bera"
                }
            },
            "lastModifiedBy": {
                "user": {
                    "email": "ribera@xxxxxxxxxx.com",
                    "displayName": "Rinki Bera"
                }
            },
...
]
}

Thank you.