Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Fola
  •  Fola
  • No customer Topic Starter
2018-03-14T08:38:46Z
We are creating SFTP connections programmatically via the VisualCron Api.
Is there a way to test these and other connection types through the Api?

Any pointers to code samples that do this would be appreciated as well.

Thanks
Sponsor
Forum information
Support
2018-03-14T09:03:45Z
No, we do not have any built in testing for this in the API right now.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
AHTECH
2020-08-07T23:10:27Z
I found a way to test a Connection object in the latest versions of VC (I'm using 9.1.5).
Use the Connections.Test method to test and return the results.
I haven't tested this but here is a code sample (brought together from other posts)

 c = new Client();
                c.LogToFile = true;

                Connection conn = new Connection();
                conn.UseADLogon = true;
                conn.UseCompression = true;
                conn.Port = 16444;
                conn.Address = "vcserver.com";
                conn.ConnectionType = Connection.ConnectionT.Remote;

             
                    s = c.Connect(conn, true);
             
                while (!s.Connected)
                {
                    System.Threading.Thread.Sleep(100);
                }

//I setup  a template connection on the server and use its guid to pull it back so I can default some params below
ConnectionClass cTemplate = s.Connections.Get("GUID");
 ConnectionClass connection = new ConnectionClass(ConnectionClass.ProtocolT.SFTP);
                            connection.Name = "TEST CONNECTION";
                            connection.Group = "TEST CONNECTION GROUP";
                            connection.AuthenticationType = ConnectionClass.AuthenticationT.Password;
                            connection.UserName = c.Encrypt("USERNAME");
                            connection.PassWord = c.Encrypt("PASSWORD");
                            connection.PasswordAuthentication = true;
                            connection.Host = c.Encrypt("test.com");
                            connection.Port = 22;
                            connection.EncryptionAlgorithms = cTemplate.EncryptionAlgorithms;
                            connection.KEXAlgorithms = cTemplate.KEXAlgorithms;
                            connection.MACAlgorithms = cTemplate.MACAlgorithms;
                            connection.SecurityMode = ConnectionClass.SecurityModeT.Explicit;
                            connection.AutoAdjustCiphers = true;
                            connection.AutoAdjustFTPCiphers = false;
                            connection.PrivateKeyPath = "";
                            connection.UseCompression = true;
                            connection.AdjustPasvAddress = false;
                            connection.ACCT = c.Encrypt("");
                            connection.PrivateKeyPassWord = c.Encrypt("");
                            connection.SAPExternalUsername = c.Encrypt("");
                            connection.LogReceived = true;
                            connection.LogSent = true;
 TestConnectionClass testConnObj = new TestConnectionClass();
                        testConnObj.Connection = connection;
                        TestConnectionResultClass testResult = s.Connections.Test(testConnObj);
                        System.Threading.Thread.Sleep(1000);
                        Console.WriteLine(testResult.ErrorMessage);
                        Console.WriteLine(testResult.Success.ToString());
Similar Topics
Users browsing this topic
Scroll to Top