I'm trying to find out from files parents value to find out the contents of certain folders. I am using API version three. For some reason, Google does not allow to know the property "parents", always returns null.
What could be the reason? I thought that this is a limited "scopes" parameter, but extending the rights, the result is the same.
So I connect:
string[] scopes = new string[] { DriveService.Scope.Drive, DriveService.Scope.DriveFile, DriveService.Scope.DriveMetadata, DriveService.Scope.DriveAppdata};
var clientId = "id"; // From https://console.developers.google.com
var clientSecret = "secret"; // From https://console.developers.google.com
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
{
ClientId = clientId,
ClientSecret = clientSecret
},
scopes,
Environment.UserName,
CancellationToken.None,
new FileDataStore("MyAppsToken111")).Result;
DriveService service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "MyAppName",
});
So I get files for example:
var list = service.Files.List().Execute().Files;
foreach (var file in list)
{
Console.WriteLine(file.Parents == null);//always: true == (file.Parents == null)
}
I am sure that at least one file must have a non-null parent property. Can you please tell me what I missed?