I'm currently using shareplum and was able to do the download thing using this code below:
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
import csv
authcookie = Office365('https://bboxxeng.sharepoint.com/', username='---', password='---').GetCookies()
site = Site('https://bboxxeng.sharepoint.com/sites/TESTIAN', version=Version.v2016, authcookie=authcookie)
folder = site.Folder('Shared%20Documents/Test')
data = folder.get_file('Office ss E1.csv')
with open('asas.csv', 'wb') as f:
f.write(data)
f.close()
I tried using list_data = sp_list.GetListItems()
but have no luck extracting the file names, I've also ready and tried googling but still no luck.
I understand you want to list all files in a folder so that you can download or do other modification via the file name. If so, you can get it via below attrbutes:
folder = site.Folder('Shared Documents/test')
allfiles= folder.files
print(allfiles)
//////////// Updated //////
The result contains file name and other properties.
For example, i want to get the name of first file from the returned result.
allfiles= folder.files
demofile= allfiles[0]
print(demofile['Name'])
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.