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.


Bob Silva
2013-05-18T05:11:52Z
Greetings...

Anyone have a short C# snippet for connecting to a remote server with the current user's AD credentials?

TIA,
Bob
Sponsor
Forum information
Bob Silva
2013-05-20T15:53:47Z
Welp,

Accidently discovered UseADLogon (undocumented). So, set that to true, but still no joy. Code currently looks like this:

Quote:

List<JobClass> jc = new List<JobClass>();

Client c = new Client();
Server s = new Server();

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

s = c.Connect(conn, true);
Jobs j = new Jobs(ref s);
jc = j.GetAll();
c.Disconnect(s);



Everything works fine, but the JobClass List (jc) still comes back with Count = 0. When I login with the VC Client itself, I get several jobs.

Any thoughts?

TIA,
Bob
Support
2013-05-20T16:15:14Z
Have you enabled AD logon in the Server settings and added the user?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Bob Silva
2013-05-20T16:19:12Z
Yup. The user is me. 😁
I can login to the server with the VC client just fine. When I do it via code, I get no complaints about the connection, I just seem to get no jobs back.

Thanks,
Bob
Support
2013-05-20T16:32:25Z
What does the log file say (in terms of error) when you try to logon?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Bob Silva
2013-05-20T18:37:48Z
Good question!

Apparently, I am logging in successfully:

Quote:

User "Bob Silva" (bsilva) - Logged in succesfully through Socket (4bae93dc-997c-489d-a283-948e02d7d45a)



So, now the question becomes, why does the JobClass list come back empty? The code there is simply:

Quote:

Jobs j = new Jobs(ref s);
jc = j.GetAll();



Seems straightforward enough, but, perhaps, I'm missing some additional required setup. Are there are C# code samples you might point me at?

Thanks,
Bob
Support
2013-05-20T20:43:52Z
Perhaps you have set sync to false when calling Connect?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Bob Silva
2013-05-20T21:36:56Z
Nope.

If you look at the code in Post #2 (above), you'll see it's coded to "true", even though that is the default...

Is that code fragment (in Post #2) the basic idea?

BTW, the count is 0 even before I disconnect. (I was thinking that Disconnect might be clearing the object.)

Thanks,
Bob
Bob Silva
2013-05-20T21:43:41Z
Never mind...

Developer = Idiot.

I was interpreting the object model incorrectly.

Instead of:

Quote:

Jobs j = new Jobs(ref s);


I should have used:

Quote:

Jobs j = s.Jobs;


I'm getting jobs back now...

Thanks,
Bob
Support
2013-05-21T07:27:16Z
Sorry, missed that. Glad you resolved it! 😁
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top