Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

gk87

martin wrote:

Can you connect to that WebDAV server using any WebDAV client?


I tried WinSCP and BitKinex but I'm not able to connect. The only working option is Windows Explorer (Add a network location). I also asked the webdav URL provider to clarify on this.
martin

Can you connect to that WebDAV server using any WebDAV client?
gk87

Hi Martin,

Thanks for the reply. Find attached the logfiles for both the opening post config and the new config as you suggested. It appears that when using your config opening the session hangs / gets in some sort of loop. No connection can be established.

    $sessionOptions = New-Object WinSCP.SessionOptions -Property @{

      Protocol = [WinSCP.Protocol]::Webdav
      HostName = "webdav.domain.com"
      WebdavSecure = $True
      UserName = "account"
      Password = "P@ssw0rd"
    }
martin

Re: Issue putting file to webdav location

For a start, remove the slash from HostName and set WebdavSecure instead of setting PortNumber to 443.

If that does not help, please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
gk87

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:
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.