Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

shere point file uploading to doc repository python

from shareplum import Office365
from shareplum import Site
from shareplum.site import Version

#Logging info
server_url = "https://example.sharepoint.com/"
site_url = server_url + "sites/my_site_name"
Username = 'myusername'
Password = 'mypassword'
Sharepoint_folder = 'Shared Documents'
fileName = 'myfilename'

def file_upload_to_sharepoint(**context):
    authcookie = Office365(server_url, username = Username, password=Password).GetCookies()
    site = Site(site_url, version=Version.v365, authcookie=authcookie)
    folder = site.Folder(Sharepoint_folder)
    with open(fileName, mode='rb') as file:
        fileContent = file.read()
    folder.upload_file(fileContent, "filename.bin")

file_upload_to_sharepoint()
Comment

PREVIOUS NEXT
Code Example
Python :: linkedin bot python 
Python :: python complement operator 
Python :: Best websites to learn Python 
Python :: discord.py main file setup 
Python :: list foreach pyhton 
Python :: ring Search List Item 
Python :: ring convert between Numbers and Bytes 
Python :: function to find the mean of column in dataframe in python 
Python :: ring check if a Ring function is defined or not 
Python :: ring Trace library usage to pass an error 
Python :: ring Desktop, WebAssembly and Mobile Using QTreeView and QFileSystemModel 
Python :: Use miraculous with enviroment variable token 
Python :: Uso de lambda 
Python :: numpy mask without losing shape 
Python :: instaed of: newlist = [] for word in wordlist: newlist.append(word.upper()) 
Python :: python durchschnitt liste 
Python :: to expend hidden columns and rows 
Python :: print single pixel from numpy 
Python :: dataflair python 
Python :: commanding ip camera(onvif-ptz-control-python) 
Python :: python colorama 
Python :: self.tk.call( _tkinter.TclError: unknown option "-relwdth" 
Python :: how to create a calculator in python 
Python :: r Return each result with an index 
Python :: python fork error 
Python :: django rest serializer depth 
Python :: sklearn make iterator cv object 
Python :: string to 2d array python 
Python :: ENCAPSUALTION 
Python :: formula for nth fibonnaci number 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =