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

martin

Re: 409 conflict when uploading files

Please post full session logs file showing an upload of the same file to the same remote folder, both from GUI and the code.
Axel_RT

409 conflict when uploading files

Hello,
I have installed the WinSCP, Version is 6.1
Connected via WebDAV to our Nextcloud.
Always when I start the session from the desktop – it works fine.
I am always able to upload files (drag & drop).

But I have created a session in C# too
(using "WinSCP.exe" and "WinSCPnet.dll" from the same version 6.1).

In this case – the connection also seems to work.
Because the command session.Open(options) shows NO error.

But when this command is being executed
result = session.PutFiles(myLocalPath + myFileName, myRemotePath, false, transferoptions);

the error "409 conflict" occurs.

Here is the imoportant part of my code:
public ClassWinSCP(string thepath,string thefilename) 
{
    myLocalPath = @"L:\ITORG\2_Teamassistenz, Verwaltung\Teammitglieder\\goede\_AKTUELL\";
    myFileName = "*";
 
    string myRemotePath = "/nextcloud/public.php/webdav";
    string myLogfile = "Nextcloud-Upload.log";
    string myLogPath;
 
    Session session = new Session();
    SessionOptions options = new SessionOptions();
    TransferOptions transferoptions = new TransferOptions();
    TransferOperationResult result;
 
    myLogPath = myLocalPath + myLogfile;
    session.DebugLogPath= myLogPath;
 
    options.Protocol = Protocol.Webdav;
    options.HostName = "myserver";
    options.PortNumber= 9999;
    options.Secure= true;
    options.RootPath= myRemotePath;
    options.UserName = "XXXXXXXXX";
    options.Password = "YYYYYYYYY";
    session.Open(options);
    transferoptions.TransferMode = TransferMode.Binary;
 
    result = session.PutFiles(myLocalPath + myFileName, myRemotePath, false, transferoptions);
    result.Check();
}

Thanks for help!
Sincerely yours
Axel Goede