0

How can I get the subfolders of a drive folder?

The v2 service.Children.List(folderId) method seems to have disappeared.

I'm using the c# Drive.v3 api.

Tobiq
  • 2,489
  • 19
  • 38

1 Answers1

2

From https://developers.google.com/drive/v3/web/quickstart/dotnet

        FilesResource.ListRequest listRequest = service.Files.List();
        listRequest.PageSize = 10;
        listRequest.Fields = "nextPageToken, files(id, name)";

        // List files.
        IList<Google.Apis.Drive.v3.Data.File> files = listRequest.Execute()
            .Files;

This will list all files. To list files within a given folder id (ie. its children), refer to https://developers.google.com/resources/api-libraries/documentation/drive/v3/csharp/latest/classGoogle_1_1Apis_1_1Drive_1_1v3_1_1FilesResource_1_1ListRequest.html and add

        listRequest.Q = "'my_folder_id' in parents";
pinoyyid
  • 21,499
  • 14
  • 64
  • 115