Does anyone know how to use the GoggleDrive API to get files that are in the Shared Drives category.
I have a API call that I can use to get metadata via FileID which
works for files that are shared with me, but when I attempt to get by a fileID that is on a shared Drive, I get an error ” File Not Found.”.
See Code Below with output:
def GetFileInfoById(TheFileId):
service = authenticate()
# Call the Drive v3 API
results = service.files().get(fileId=TheFileId,
fields="id, name, md5Checksum, webViewLink").execute()
pprint(results)
if __name__ == "__main__":
GetFileInfoById(' FILE ID Here')
The output I get is :
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 404 when requesting
https://www.googleapis.com/drive/v3/files/ File ID Here ?fields=id%2C+name%2Cmd5Checksum%2CwebViewLink&
alt=json returned "File not found: 1xJImDFvjIEJlLKUxFqzarm6fSWV8Vlxe.". Details:
"[{'message': 'File not found: File ID Here.', 'domain': 'global', 'reason': 'notFound',
'location': 'fileId', 'locationType': 'parameter'}]">
This code works as expected for files I own and files shared with me. I am getting a list
of file ID’s from google API – that includes my shared Drive (I used the corpora=’AllDrives’ parameter in the list call). Is there a way to include all of the drives in the get call? The list call did not include everything until I added the paramerters…