Thank you, I have not tried, will be trying today and tomorrow.
- asher629
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = sftpHostName, //Destination server to which we need to connect to
UserName = sftpUserId, //Destination server UserId (or Source server user id?)
SshHostKeyFingerprint = sftpHosyKeyFingerPrint,
SshPrivateKeyPath = sftpPrivateKeyPath //Entire physical path that maps to .ppk private key (Eg: C:\PrivateKey\SFTPKey.ppk)
};
//Start Session
using (Session session = new Session())
{
session.ExecutablePath = executablePath;
session.Open(sessionOptions);
// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
TransferOperationResult transferResult;
transferResult = session.PutFiles(fileToUpload, sftpDestinationServerPath, false, transferOptions);
// Throw on any error
transferResult.Check();
}