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.


nkheynis88
2015-12-29T21:01:04Z
I put my current code below. I need to loop through all the jobs. If the state of the job is failed. I need to display the Output(Error) Message as it displays when checking directly in visual cron. How do I get the Output(Error) Message for the Job?


Server s = new Server();
Client c = new Client();
Connection conn = new Connection();
conn.ConnectionType = Connection.ConnectionT.Remote;
conn.Address = "***.**.**.***"; //Con1
conn.TimeOut = 10 * 60; // 10 Mins
conn.UserName = "admin";
conn.PassWord = "";
var connTest = c.Connect(conn, true);
s = connTest;

List<JobClass> lJobs = new List<JobClass>();
lJobs.AddRange(s.Jobs.GetAll());

var lOrderedJobsByName = lJobs.OrderBy(x => x.Name);


foreach (var j in lOrderedJobsByName)
{
}
Sponsor
Forum information
Support
2015-12-31T20:18:48Z
Hi,

It seems that you are using VisualCron .NET API, not the VisualCron Web API so I have edited the subject to avoid misunderstanding.

Output and error output is associated with a Task in a Job so first you should:
1. Get a list of Tasks in the Job
2. For each Task in the list,
you can get the 'StandardError'.
For sample code on how to accomplish 1 and 2, please refer to the sample project provided in the API folder of the VisualCron installation directory.
Please find some relevant excerpts from this project below:

void Processes_TaskProcessEndedStatic(ref Server server, VCTaskProcessClass tpc)
{
if (tpc.HasStandardOutput)
{
LogTaskOutputClass taskOutput = server.Log.GetTaskOutput(tpc.UniqueId, tpc.TaskId, tpc.TaskPId);
if (taskOutput != null)
{
// taskOutput.StandardError
}
}
}
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top