Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Read a SharePoint FOLDER with more than 5,000 items.

Open doorssl opened this issue 11 months ago • 1 comments

I am using this def to list the files in a sharepoint folder. ---------------- my def ---------------------------------

def list_files_sharepoint(folder_url):
    
    folder = ctx.web.get_folder_by_server_relative_url(folder_url)
    ctx.load(folder)
    ctx.execute_query()

    files = folder.files
    ctx.load(files)
    ctx.execute_query()

    sharepoint_files = [file.properties["Name"] for file in files]
    return sharepoint_files

However, my folder has 7,000 items.

I get this error when I run my function:

'-2147024860, Microsoft.SharePoint.SPQueryThrottledException'

Can someone help me read data from a folder with more than 5,000 items?

I don't have any sharepoint lists, just a folder with +5,000 items.

doorssl avatar Jan 06 '25 16:01 doorssl

Seems to be a duplicate of #882

matt-davis27 avatar Jan 06 '25 18:01 matt-davis27