.NET (c# or VB.NET)

<< Click to Display Table of Contents >>

Navigation:  Using VisualCron > Interacting with VisualCron > VisualCron API >

.NET (c# or VB.NET)

.NET

A c# project sample with a lot of functionality exists in the API folder of the installation folder.

 

We recommend looking at the basic tutorial for the API here - then look at the API sample project.

 

Below is a quick sample in c#:

 

// create Server object that holds all VisualCron objects like Jobs, Credentials, Connections etc.

Server s;

// create Client object that is used to connect to the Server

Client c = new Client();

            

// create a Connection object which tells how VisualCron should connect

Connection conn = new Connection();

// use remote connection method to connect to a Server instance on another computer (default local connection)

conn.ConnectionType = Connection.ConnectionT.Remote;

// specify the DNS name or IP of remote server

conn.Address = "192.168.1.123";

// specify username you want connect as (default "admin") - user must exist in the Manage user Permissions window at Server

conn.UserName = "admin";

// specify password you want to connect with (default empty)

conn.PassWord = "";

// set below to true if you want to connect with your AD credentials (must be setup on Server to support) - if set you ignore setting username and password

//conn.UseADLogon = true;

            

// connect to Server, set sync to true to get all Server objects

s = c.Connect(conn, true);

 

// loop through existing Jobs

foreach (JobClass j in s.Jobs.GetAll())

{

       // write Job name to console

       Console.WriteLine(j.Name);

}

 

// finally disconnect

s.Disconnect();