Mayank
Mayank

Reputation: 1993

insufficientScopes when listing files from drive.appdata scope in Drive API V3

I am unable to list files in drive.appdata scope. I receive this error: The granted scopes do not give access to all of the requested spaces.

list request is accepted by drive.appdata scope.

Code:

response = self.service.files().list(q="name = 'test.txt'").execute()

Upvotes: 1

Views: 412

Answers (2)

Aerials
Aerials

Reputation: 4419

You need to search within the appDataFolder; see docs here.

Adapt your query to include it as a parent to the files which you want to list.

Example:

response = self.service.files().list(q="name = 'test.txt' AND 'appDataFolder' in parents").execute()

Update:

The query string can remain the same, and set the field spaces to 'appDataFolder' as suggested in the aforementioned docs.

Upvotes: 1

Mayank
Mayank

Reputation: 1993

Adding spaces='appDataFolder' solved it:

response = self.service.files().list(spaces='appDataFolder',q="name = 'test.txt'").execute()

Upvotes: 2

Related Questions