Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting specific fields with Google Drive Api v2

I have an error,

Google.Apis.Requests.RequestErrorInvalid field selection filesize [400]Errors [Message[Invalid field selection filesize] Location[fields - parameter] 

When I call request.Fields = "items(id,title,filesize)"; this works fine: request.Fields = "items(id,title)";

in this context,

DriveService service = new DriveService(new BaseClientService.Initializer()
{
    HttpClientInitializer = credential,
    ApplicationName = "Drive API Sample",
});

FilesResource.ListRequest request = service.Files.List();
request.MaxResults = 100;
request.Q = string.Format("(title contains '{0}') and (mimeType contains 'image/')",filename);
request.Fields = "items(id,title)";

If I dump out the item result, it does indeed contain a filesize column, not always, for folders and some other it's null.

Anyone ran into this ? My googlefu doesn't really turn anything up...

like image 322
hreinn1000 Avatar asked Dec 03 '25 14:12

hreinn1000


1 Answers

@hreinn: Though its a very old post, but just for others to have this: In V3, this is size. So listRequest.Fields = "files(id, size)";

like image 120
Atihska Avatar answered Dec 05 '25 17:12

Atihska