boukaka
asked on
Python 3 script to upload files to sharepoint 2010
I need a python 3 script to upload files to sharepoint 2010. I can't find anything that works because apparently REST api doesn't work for 2010.
Did you try the WEBDAV route?
ASKER
I'm looking at that but I can't seem to find any examples where it interacts with a sharepoint server. I'm looking for an example script to start from, do you know of one? I'm fairly new to Python.
Pypi is a nice source to look around: https://pypi.org/project/webdavclient/
There also is a sharepoint access module, not sure it that uses the REST Api though. https://pypi.org/project/sharepoint/
There also is a sharepoint access module, not sure it that uses the REST Api though. https://pypi.org/project/sharepoint/
ASKER
I have found a Powershell solution that works - I wish it was in python - does anyone know how to convert this?
# Set the variables
$destination = "http://portal.contoso.com/sites/stuff/Docs”
$File = get-childitem “C:\Docs\stuff\Secret Sauce.docx”
# Since we’re doing this remotely, we need to authenticate
$securePasssword = ConvertTo-SecureString "pass@word1" -AsPlainText -Force
$credentials = New-Object System.Management.Automati on.PSCrede ntial ("contoso\johnsmith", $securePasssword)
# Upload the file
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = $credentials
$webclient.UploadFile($des tination + "/" + $File.Name, "PUT", $File.FullName)
# Set the variables
$destination = "http://portal.contoso.com/sites/stuff/Docs”
$File = get-childitem “C:\Docs\stuff\Secret Sauce.docx”
# Since we’re doing this remotely, we need to authenticate
$securePasssword = ConvertTo-SecureString "pass@word1" -AsPlainText -Force
$credentials = New-Object System.Management.Automati
# Upload the file
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = $credentials
$webclient.UploadFile($des
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fantastic, thank you!