Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

File Properties #168

Open
TigerTape opened this issue Jul 2, 2021 · 0 comments
Open

File Properties #168

TigerTape opened this issue Jul 2, 2021 · 0 comments

Comments

@TigerTape
Copy link

TigerTape commented Jul 2, 2021

Hi, I'm loving shareplum and I've got a lot done with it. I'm currently in the process of uploading a large number of files and I need to set properties/metadata of the files. I can't seem to find a way of doing this. My folder has over 5000 files in, and I get errors when I try to list the contents of the folder to then get a file reference I can set properties on, e.g.

allfiles = folder.files
myimg = allfiles['Name'==fname]
myimg['Approved']='No'

I found the rest python library that gives you a file context, for the file you've just uploaded. Is there any way of achieving the following?

# 3. Upload the content to the SharePoint document library 
sp_folder = ctx.web.lists.get_by_title(SP_DOC_LIBRARY).root_folder 
sp_file = sp_folder.upload_file(file_name, file_content) ctx.execute_query()

# 4. Add metadata to the document by assigning a value to the Category property 
item = sp_file.listItemAllFields item.set_property("Category","R Language")
item.update()

https://www.mssqltips.com/sqlservertip/6799/file-handling-sharepoint-document-library-python/

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

No branches or pull requests

1 participant