Google Drive API - Search all files inside a root folder and sub folders in C#


I only have objective-C sample code for search all file and folder.

I use recursive way for search all file.

you can use file MIMEType for determine folder or file.


Related videos on Youtube

Gopal Biswas
Author by

Gopal Biswas

Updated on November 30, 2022


  • Gopal Biswas
    Gopal Biswas about 1 month

    I want to search all files inside a root folder and its sub folders in Google Drive API using C#. Suppose there is a root folder "A" which contains 5 files and a sub folder named "B". The sub folder "B" contains 4 files only. Now I have to populate all the files inside the root folder(5 + 4 = 9 files). Currently I'm populating files like-

    FilesResource.ListRequest list = service.Files.List();
     list.OrderBy = "createdDate";
                    list.MaxResults = 1000;
    if (search != null)
                        list.Q = search;
      FileList filesFeed = list.Execute();

    If anyone has any idea please share.


    • comrademike
      comrademike about 9 years
      Are you sure you haven't switched wifi off with a keystroke? laptops have a key set to turn wifi off for when you are on planes. On mine it is f12. worth checking first anyway.
    • Eric Carvalho
      Eric Carvalho about 9 years
      Welcome to Ask Ubuntu! Please use the contact us link at the bottom of this page to ask for your unregistered account and your new registered account to be merged. Thanks.
    • tropikalista
      tropikalista about 9 years
    • BugFinder
      BugFinder over 6 years
      What problem specifically are you having
    • DaImTo
      DaImTo over 6 years
      What is search? list will automatically return all the files and folders on drive. Are you trying to say you just want the files and not the directories?
    • Gopal Biswas
      Gopal Biswas over 6 years
      @ DaImTo... correct. I just need to return all the files not the directories with all file properties.