Searching and filtering Items in OneDrive

Search the hierarchy of items in OneDrive for items matching a query. You can search and/or filter results to find the items your app is looking for.

Search returns matching results from the item specified in the URL and all children of that item. Filtering works on the collection of items returned, which can be either all children when using search, or just the immediate children when using a collection.

Search request

GET /drive/root/search(q='vacation')
GET /drive/items/{item-id}/search(q='vacation')

Note: This method has a different signature for Microsoft Graph and OneDrive API. See OneDrive API endpoint differences for more information.

This method supports optional query string parameters to shape the response. The search results collection can be filtered using the filter query string parameter.

Note: Make sure to properly query string encode any characters in the query parameter.

Query string parameters

Name Value Description
q string The query text used to search for items. Values may be matched across several fields including filename, metadata, and file content.


GET /drive/root/search(q='{search-text}')


This method returns an object containing an array of Items that match the search criteria. If no items were found, an empty array is returned.

If there are too many matches the response will be paged and an @odata.nextLink property will contain a URL to the next page of results. You can use the top query parameter to specify the number of items in the page.

HTTP/1.1 200 OK
Content-type: application/json

    "value": [
        "id": "0123456789abc!123",
        "name": "Vacation photos",
        "folder": {},
          "onClickTelemetryUrl": "!123"
        "id": "0123456789abc!456",
        "name": "Summer Vacation Rentals.docx",
        "file": {},
          "onClickTelemetryUrl": "!456"
    "@search.approximateCount": 12,
    "@odata.nextLink": "!asd"

Note: The response object is truncated for clarity. All default properties are returned from the actual call.

Response properties

Name Value Description
value Array of Items A collection of results matching the query.
@search.approximateCount Integer An approximate count of the total number of items that matched the query.
@odata.nextLink URL A URL that can be used to retrieve the next page of the results

Error responses

See Error Responses for more information about how errors are returned.