Skip to content

Cannot list items in a library #963

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
WojciechBuda88 opened this issue May 8, 2025 · 0 comments
Open

Cannot list items in a library #963

WojciechBuda88 opened this issue May 8, 2025 · 0 comments
Labels

Comments

@WojciechBuda88
Copy link

Hello,

i did find such code here in one of the issues:

from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.listitems.listitem import ListItem
from office365.runtime.auth.client_credential import ClientCredential

list_title = "<title>"
page_size = 5000

site_url = "https://.sharepoint.com/sites/<site_name>/"
client_id = "zzzzz"
client_secret = "xxxxx"

creds = ClientCredential(client_id, client_secret)
ctx = ClientContext(site_url).with_credentials(creds)

def print_progress(items):
"""
:type items: office365.sharepoint.listitems.collection.ListItemCollection
"""
print("Items read: {0}".format(len(items)))

large_list = ctx.web.lists.get_by_title(list_title)
all_items = large_list.items.get_all(page_size, print_progress).execute_query()

I did apply the code in Azure Databricks, and even thou I know the files are existing there, the result is: Items read = 0

the script works fine, if i change a list_title to something non-existing, I will get error 404, so the location is fine.

I want to point out, that when im in my SP library location "Shared Documents" ("Dokumenty" in polish), its address is:
https://.sharepoint.com/sites/<site_name>/Shared%20Documents/Forms/AllItems.aspx

and when I open a file called '123.xlsx' at that locatoin, its address is:
https://.sharepoint.com/:x:/r/sites/<site_name>/_layouts/15/Doc.aspx?sourcedoc=%7B8B31F683-EF38-4597-89D9-8E5BA5E955CB%7D&file=123.xlsx&action=default&mobileredirect=true

@vgrem vgrem added the question label May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants