When trying to access the WebDav API of nextcloud via WinSCP, I am facing several problems with the right usage of root folder, remote path, etc. To save others some time, here is the working code I came up with to upload a file into a remote (shared) folder.
Lessons learned:
- server name is provided without protocol, this is defined by the SessionOptions.Protocol
- root folder may not be empty, must be at least "/"
- the next cloud provider / the configuration defines the root url, so "webdav" or "dav" after remote.php are predefined. Normally you can see it in the lower left corner when using the webapp of nextcloud in the settings section
- "files/user" or "files/username" is not necessarily required - defined by the hoster / configuration as well
- the connecting user must have access rights to the given directory you should provide file access permissions to others (if wanted) by providing FilePermissions in the TransferOptions
However, there is no working example in the WinSCP, the nextcloud documentation, nothing to find here as well.