Skip to content

drive.get_items() do not return File type DriveItems, just Folder type ones #864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MattSom opened this issue Oct 23, 2022 · 2 comments
Open
Labels
needs triage Not yet classified, needs a closer look

Comments

@MattSom
Copy link

MattSom commented Oct 23, 2022

As the title says. I only get the folders returned from the root, the files are omitted. In child folders the files are returned as well. Is this intended?

@MattSom MattSom changed the title drive.get_items() do not return File typed DriveItems, just folder drive.get_items() do not return File type DriveItems, just Folder type ones Oct 23, 2022
@alejcas
Copy link
Member

alejcas commented Oct 27, 2022

can you share the code? what's drive there?

@MattSom
Copy link
Author

MattSom commented Oct 28, 2022

credentials = (
    app.config.get("SP_CLIENT_ID"),
    app.config.get("SP_CLIENT_SECRET"),
)

token_backend = FileSystemTokenBackend(
    token_path=app.config.get("SP_TOKEN_PATH"),
    token_filename=app.config.get("SP_TOKEN_FILE"),
)

account = Account(
    credentials=credentials,
    auth_flow_type="credentials",
    token_backend=token_backend,
    tenant_id=app.config.get("SP_TENANT_ID"),
)

site = account.sharepoint().get_site(app.config.get("SP_SITE_ID"))

drive = site.list_document_libraries()[0]

drive.get_items()

The last line returns:

[Folder: copies,
 Folder: copytest,
 Folder: url,
 Folder: vta,
 Folder: vta_copy]

But actually opening the sharepoint drive I can see that the root folder has tons of different files next to these folders. So only Folder subtyped DriveItems are returned.

@alejcas alejcas added the needs triage Not yet classified, needs a closer look label Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Not yet classified, needs a closer look
Projects
None yet
Development

No branches or pull requests

2 participants