onedrive-sharepoint-python-sdk icon indicating copy to clipboard operation
onedrive-sharepoint-python-sdk copied to clipboard

Access files from shared onedrive folders

Open tavomc opened this issue 11 months ago • 4 comments

Hello,

When I use list_items it only lists the files under my root drive and not the files in shared folders, is there a way to access those?

tavomc avatar Jan 13 '25 07:01 tavomc

Not entirely sure but most likely extra permissions required.

fire015 avatar Jan 13 '25 16:01 fire015

Thanks, I do have the permissions but It seems the path defaults to /drive/root and even using folder_path=different path it tries the url https://graph.microsoft.com/v1.0/me/drive/root:differentpath

tavomc avatar Jan 14 '25 15:01 tavomc

Can you show your code?

fire015 avatar Jan 15 '25 14:01 fire015

hi, try this please:

from msdrive import OneDrive TOKEN_="EwBoBxxxLM" drive = OneDrive(TOKEN_) #items=drive.list_items(item_path="/Documents/")# Get root files

#here list your files from "YOUR_FOLDER" items=drive.list_items(folder_path="/YOUR_FOLDER/") # get files from your folder

for item in items["value"]: nombre = item["name"] tipo = "Carpeta" if "folder" in item else "Archivo" print(f"{nombre} - {tipo}")

csgomezg0 avatar Aug 24 '25 22:08 csgomezg0