Hi there, pretty new to Python and Box SDK. I'm trying to search for certain filetypes and get information like Filename, full folder path, content created, modified, etc.
I was able to connect and get the results, but I'm having trouble parsing out the file object that Box search function returns.
I have something like the below, but when I try to get the path_collection for the folder path, I get a "string indices must be integers". Any tips or ideas on how to get this information?
resp = client.search_files(
query_string='.pdf', ancestor_folder_ids=None, file_extensions=['pdf'])
if resp['total_count'] > 0:
for entry in resp['entries']:
box_filename = entry['name']
box_fileid = entry['id']
box_created_at = entry['created_at']
box_modified_at = entry['modified_at']
box_content_created_at = entry['content_created_at']
box_content_modified_at = entry['content_modified_at']
for path_collection in entry['path_collection']:
for pc_entry in path_collection['entries']:
box_folderpath = box_folderpath + pc_entry['name']
else:
print("PDF files not found")The eventual goal is to get a CSV of PDF files in a certain folder tree and their associated metadata.