Skip to content
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

List all files with all Properties/Fields for a given folder Path #931

Open
caswdb opened this issue Jan 8, 2025 · 0 comments
Open

List all files with all Properties/Fields for a given folder Path #931

caswdb opened this issue Jan 8, 2025 · 0 comments

Comments

@caswdb
Copy link

caswdb commented Jan 8, 2025

Hi All,

I am trying to get get a list of all files in a given Folder including meta data fields.
When I run a REST call, I can see the returned data includes all meta properties in the ListItemAllFields:

/sites/test_site/_api/web/GetFolderByServerRelativeUrl('/folder_url')/Files?$expand=ListItemAllFields

I am trying to do this with the following code but I am unable to retieve the ListItemAllFields for the files as well.
If collect the ListItemAllFields for each file one by one, it works but this for my target folder this takes about 15 minutes while the above REST call takes about 5 seconds.

ctx = get_sharepoint_context_using_user()
target_folder_url = "folder_url"
root_folder = ctx.web.get_folder_by_server_relative_path(target_folder_url).expand(['listItemAllFields'])
files = root_folder.get_files(True).execute_query()

files[0].listItemAllFields.get_property('properties')

How can I accomplish this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant