Has anyone been able to send file(s) to SFTP Server from Mongoose using scripting?
I have been trying several way, but I got stuck on always getting a FALSE response and nothing gets transferred regardless what I do.
Source Code (cleaned up to not show any company relevant information) - I have highlighted to problem code:
public void sendFTP() {
string filterIDO = "";
string errorMsg = "Something went wrong!";
string fileName = "";
string currDateTime = DateTime.Now.AddDays(-10).ToString("yyyy/MM/dd hh:mm tt");
filterIDO = "CreatedDate >= '" + currDateTime + "'"; //Request created within the last 10 days
fileName = "D:\Myfiles\export_file.csv";
ThisForm.CurrentIDOCollection = ThisForm.PrimaryIDOCollection;
ThisForm.CurrentIDOCollection.Filter = filterIDO;
ThisForm.CurrentIDOCollection.Refresh();
ThisForm.Components["grid_Data"].IDOCollection.ExportCollection(false, fileName, false); //Exports the IDO Data to a local File - This works fine!!
//Send File to FTP instance
if(Application.FileServer.ImportToFileSeverFromLocal(fileName, "export_file.csv", "SFTP_FileServer", "LogicalFolder", out errorMsg, null)) {
Application.ShowMessage("Success");
} else {
Application.ShowMessage("Failed"); //I am ALWAYS ending up here for some reason!?
}
}
Appreciate any insight and/or suggestions anyone might have, since I want to make this process MT Cloud compliant for our upcoming Cloud Migration.
/RB