简体   繁体   中英

Uploading files of different sizes on sharepoint office365 REST Python Client

I want to upload some files to sharepoint via office365 REST Python client.

On documentation on github, I found two examples:

  • one for larger files where this is executed:

uploaded_file = target_folder.files.create_upload_session(local_path, size_chunk, print_upload_progress).execute_query()

  • one for small files : target_file = target_folder.upload_file(name, file_content).execute_query() .

In my case, I want to be able to upload files who are small and also files who are very large. For testing, I wanted to see if the method for larger files works with smaller files too. With a small file, while putting the size_chunk at 1Mb, the uploading was done, but the file uploaded was empty (0b), so I lost my content while uploading.

I wanted to know if there is someone who knows how can we do something more generic for whatever size of files. Also I don't understand what is the size chunk for larger files case. Do you know how one should choose it? Thank you so much!

这个问题是通过安装 office365-rest-python-client 而不是 office365-rest-client 来解决的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM