nightlytrails
nightlytrails

Reputation: 2662

Search OneDrive files by title only with Microsoft Graph APIs

The below code searches OneDrive using Microsoft Graph APIs.

List<DriveItem> items = graphServiceClient
    .getMe()
    .getDrive()
    .getRoot()
    .getSearch("abc")
    .buildRequest()
    .get().getCurrentPage();

This codes returns all files and folders that matches the title (and probably content also as per the documentation) "abc".

How can I restrict search results to fetch only the files that matched the title "abc"?

Edit

Please vote for this feature request at-

https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/16855591-microsoft-graph-api-search-onedrive-files-by-titl

Upvotes: 1

Views: 862

Answers (1)

Michael Mainer
Michael Mainer

Reputation: 3465

There currently isn't a way to restrict the search target to just the title at this point. At this time, you'll need to perform client-side filtering of the results. Please open a feature request at the Office Developer Platform UserVoice page. Link to it from this post so other people can find and up vote it.

Upvotes: 2

Related Questions