Python upload local file to Sharepoint Team site

443 Views Asked by At

i'm trying to import .xls file to Sharepoint Team Site (Pattern : https://azureABC.sharepoint.com/teams/ABCgroup/Shared%20Documents/Forms/AllItems.aspx) using this function that i used for regular sharepoint Site :

def UploadLocalFileToSharepointSite(username, password, site_name, base_path, doc_library ,file_name) :
    authcookie = Office365(base_path, username=username, password=password).GetCookies()
    full_path = base_path+'/sites/'+site_name
    site = Site(full_path, version=Version.v2016, authcookie=authcookie)
    folder = site.Folder(doc_library)
    folder.upload_file('Upload New file', file_name)

But it's not working. enter image description here Have you any suggestions?

0

There are 0 best solutions below