shareplum
shareplum copied to clipboard
File Properties
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/