Not Generating Unique Document ID - SFTP with DotNet [OK when using WinSCP client]

Advertisement

Guest

Not Generating Unique Document ID - SFTP with DotNet [OK when using WinSCP client]

I have been using the dotNet libraries to develop an "EDI over SFTP" connection with a customer.

When I upload files using the WinSCP software, all is OK. When I use the dotNet library, copying the code taken from the Session info in WinSCP, all seems OK on my side - the files upload OK - but the customer claims it does not generate a unique 'External Document Id' (he calls it a SNRF, not sure if that means anything but they are French so could be French abbreviation).

I have attached the information received from the client. When using the WinSCP software, he gets a unique External Document Id (as per the top screen shot, even though he's highlighted Internal Document Id!).

When using the DotNet library, the 'External Document Id' is set to "Upload" (as per lower screen shot), which is the name of the sub-folder that the source file was in on our side prior to upload.

The code on our side is pretty simple:

opts = new SessionOptions()
                    {
                        Protocol = Protocol.Sftp,
                        HostName = "**removed**",
                        UserName = "**removed**",
                        Password =  
                        SshHostKeyFingerprint = "**removed**
                   };
                    RemoteFolder = @"/**removed**/**removed**/*BIN/" ;

WinSCPsession = new Session();
WinSCPsession.Open(sessionOptions);

TransferOptions transferOptions = new TransferOptions()
                {
                    FileMask = “*.*”,
                    TransferMode = TransferMode.Binary,
                };

TransferOperationResult transferResult = WinSCPsession.PutFiles(LocalFolder, RemoteFolder, false, transferOptions);

// Throw on any error
transferResult.Check();

I guess I'm missing something in the TransferOptions settings, so any suggestions on how I get my DotNet code to act in the same way as the WinSCP software would be very much appreciated. Thanks.

Description: Example of what is received by customer.

SFTP3.jpg

Reply with quote

Advertisement

WestcountryBusiness
Joined:
Posts:
2
Location:
Torquay

Additional info:

When inspecting my TransferOperationResult.Transfers I can see that the Destination property of each uploaded file contains the subfolder name from my PC.

On my PC, I am uploading 2 files from: E:\WorkingArea\EDI\EDIUpload\Upload_1234

at this line of code:
TransferOperationResult transferResult = WinSCPsession.PutFiles(LocalFolder, RemoteFolder, false, transferOptions);

LocalFolder is: E:\WorkingArea\EDI\EDIUpload\Upload_1234
RemoteFolder is: /**removed**/**removed**/*BIN/

after upload, both TransferOperationResult.Transfers[0] and [1] have a Destination folder of:
/**removed**/**removed**/*BIN/Upload_1234/

So, why has the PutFiles added the Local containing Folder name to the Destination Folder path?

Thanks.

Reply with quote

Advertisement

You can post new topics in this forum