I am trying to move Google Drive file (Google Sheet/Google Document) from Shared Team Drive to another Shared Drive but my Service account is failing to get file filed parents from v3.
I've tested with the Playground and noticed that "parents" field is only returned when you are Authenticated with Google OAuth 2.0 BUT NOT when you are using API Key (or in my case Service auth file).
https://developers.google.com/drive/api/v3/reference/files/get
Working fine with My Drive but not when returning parents for Shared Drive files.
// My Google Client is initialised
const googleClient = new google.auth.JWT(
privatekey.client_email,
null,
privatekey.private_key,
['https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/calendar']
);
// Google Drive v3
const googleDrive = google.drive({
version: 'v3',
auth: googleClient
});
// Getting File details
const file = googleDrive.files.get({
fileId,
fields: '*',
supportsTeamDrives: true
});
Can you help me with any ideas or explain me the difference in the API responses?