Solution skill
Using python, I can't access shared drive folders from Google Drive API v3
Complete solution
Using python, I can't access shared drive folders from Google Drive API v3. Notice that the API has the includeItemsFromAllDrives parameter in order to determine whether shared drive items show up or not in the results. Use when hitting this exact issue. Not for unrelated errors or different features.
TL;DR
Notice that the API has the includeItemsFromAllDrives parameter in order to determine whether shared drive items show up or not in the results. The Python API V3 wrapper also has this parameter included on it's list method implementation that needs to be included when calling the list() method: `` ... service = build('drive', 'v3', credentials [your value] # Call the Drive v3 API results = service.files().list( pageSize=10, includeItemsFromAllDrives=True, supportsAllDrives=True, fields="nextPageToken, files(id, name)").execute() items = results.get('files', []) ...
The error
Using python, I can't access shared drive folders from Google Drive API v3Fix
Notice that the API has the includeItemsFromAllDrives parameter in order to determine whether shared drive items show up or not in the results. Expected: You get the expected result; the problem is gone.
The Python API V3 wrapper also has this parameter included on it's list method implementation that needs to be included when calling the list() method: ``
... service = build('drive', 'v3', credentials [your value] # Call the Drive v3 API results = service.files().list( pageSize=10, includeItemsFromAllDrives=True, supportsAllDrives=True, fields="nextPageToken, files(id, name)").execute() items = results.get('files', []) ...`` Expected: You get the expected result; the problem is gone.Re-run the original operation and confirm the error is gone. Expected: no error, normal output.
When to use
- You hit this exact error.
- The symptom matches: Using python, I can't access shared drive folders from Google Drive API v3.
When NOT to use
- A different error message; the cause here is specific to this error.
- Unrelated issues with a different cause.
- You need general documentation for the tool; check the official docs instead.
Compatibility
Reported per the linked source.
Variant phrasings
Using python, I can't access shared drive folders from Google Drive API v3
Why it happens
Stack Overflow question (score 8, has accepted answer): I can get mydrive folders, but I can't access shared drive folders from Google Drive API. This is my code.(almost same to the Guides' code here) I followed the Guides, finished "Enable the Drive API", execute the pip command on VScode, and put credentials.json to the working directory. (I got no error, only got filename list of mydrive or 'No files found' that is printed by the code.) ``` from future import printfunction import pickle import os.path from googleapiclient.discovery import build from googleauth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request # If modifying these scopes, delete the file token.pickle. SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'] def main(): """Shows basic usage of the Drive v3 API.
Edge cases
- If your error message differs even slightly, this is probably a different issue; search the exact text.
- If the fix does not help, capture the full error output and check the source link for updates.
Evidence
Stack Overflow question (score 8, has accepted answer): I can get mydrive folders, but I can't access shared drive folders from Google Drive API. This is my code.(almost same to the Guides' code here) I followed the Guides, finished "Enable the Drive API", execute the pip command on VScode, and put credentials.json to the working directory. (I got no error, only got filename list of mydrive or 'No files found' that is printed by the code.) `` from __future__ import print_function import pickle import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request # If modifying these scopes, delete the file token.pickle. SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'] def main(): """Shows basic usage of the Drive v3 API. Resolved: Notice that the API has the includeItemsFromAllDrives parameter in order to determine whether shared drive items show up or not in the results. The Python API V3 wrapper also has this parameter included on it's list method implementation that needs to be included when calling the list() method: ... service = build('drive', 'v3', credentials [your value] # Call the Drive v3 API results = service.files().list( pageSize=10, includeItemsFromAllDrives=True, supportsAllDrives=True, fields="nextPageToken, files(id, name)").execute() items = results.get('files', []) ... `` Source: https://stackoverflow.com/questions/65388539/using-python-i-cant-access-shared-drive-folders-from-google-drive-api-v3
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_yZDaDGLK0vqEI4tJxutKCg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Using python, I can't access shared drive folders from Google Drive API v3 <span>— Vectle</span></a>