Search code examples
c#onedrivemicrosoft-graph-api

Does Microsoft Graph API for OneDrive for Business have the ability to filter on file extensions yet?


I am coding against the Microsoft Graph CSharp SDK and I have been working on proofing out the ability to filter on file extensions for OneDrive for Business. So far all the articles I have read seem to say that this feature is not yet baked into the Microsoft Graph API.

Since most of these articles are based out in 2011, I just wanted to ask if this had been addressed or if there is a workaround that anyone has implemented with success?


Solution

  • Solved

    So after digging a bit more into the docs and playing around in my sandbox application, I was able to create an internal class which consisted of different strings which I passed into the .Search() and construct my request as so:

    await graphServiceClient.Drives[custodianAct].Search(".txt").Request().GetAsync();

    Which will return all the DriveSearchCollectionPage objects that match with the given file extension.