Issue putting file to webdav location
Hi there,
I'm lost with the following code for putting a file on a webdav location named https://webdav.domain.com/subdirectory/ and I'm hoping someone can point me to the solution.
The $session.output output is:
The error returned for the putfiles is:
The code:
I hope someone can help me.
I'm lost with the following code for putting a file on a webdav location named https://webdav.domain.com/subdirectory/ and I'm hoping someone can point me to the solution.
The $session.output output is:
winscp> option batch on
batch on
reconnecttime 120
winscp> option confirm off
confirm off
winscp> option reconnecttime 120
reconnecttime 120
winscp> open "dav://account:***@webdav.domain.com%2F:443" -timeout=15
Connecting to host...
Authenticated.
Starting the session...
Session started.
Active session: [1] account@webdav.domain.com/
winscp> pwd
/:443
The error returned for the putfiles is:
Exception calling "Check" with "0" argument(s): "Error transferring file 'C:\uploadtest.csv'. 404 Not Found"
The code:
Add-Type -Path ".\WinSCP-5.13-Automation\WinSCPnet.dll"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Webdav
HostName = "webdav.domain.com/"
PortNumber = "443"
UserName = "account"
Password = "P@ssw0rd"
}
$session = New-Object WinSCP.Session
# Connect
$session.Open($sessionOptions)
# Upload files
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Automatic
#$transferResult =
$session.PutFiles("C:\uploadtest.csv", "subdirectory/uploadtest.csv", $False, $transferOptions)
$session.PutFiles("C:\uploadtest.csv", "/subdirectory/uploadtest.csv", $False, $transferOptions)
$session.PutFiles("C:\uploadtest.csv", "./subdirectory/uploadtest.csv", $False, $transferOptions)
$session.PutFiles("C:\uploadtest.csv", "./uploadtest.csv", $False, $transferOptions)
$session.PutFiles("C:\uploadtest.csv", "/uploadtest.csv", $False, $transferOptions)
$session.PutFiles("C:\uploadtest.csv", "./uploadtest.csv", $False, $transferOptions)
# Throw on any error
# $transferResult.Check()I hope someone can help me.