Summary

This article demonstrates how to use the LINQPad tool to run code that interacts with adTempus through the API.

API Background

The adTempus Client API provides programmatic access to adTempus for developers using Microsoft .NET programming languages. One common use of the Client API is to accomplish tasks such as automating the updating of job definitions or extracting data that is difficult to aggregate through the Console.

API Code Execution

Though adTempus supports .NET scripts during job execution, it does not provide a way to easily run code against the client API (a future release of adTempus may add this capability to the Console).

Users with .NET programming experience and tools can use Visual Studio or other development tools to compile and run code that uses the API.

LINQPad Background

Another approach is to use the third-party LINQPad tool, which allows you to interactively run .NET code. You can easily paste in sample code and develop your own code, and execute it against adTempus.

The free edition of LINQPad can be used for this, though we encourage you to purchase a license if you use the tool extensively.

Configuring LINQPad

You can install LINQPad on the adTempus server, or on any other computer where you have the adTempus Console (or client API components) installed.

After you download and install LINQPad, start the program. A new Query window will be created for you.

1. In the Language drop-down, select "VB Program."

2. On the Query menu, select References and Properties.

3. On the Additional References page, click Browse. Browse to the adTempus program folder ("C:\Program Files\Arcana Development\adTempus\4.0") and select the following files:

  • ArcanaDevelopment.adTempus.Shared.dll
  • ArcanaDevelopment.adTempus.Client.dll

Click Open to add the references to the query.

4. On the Additional Namespace Imports page, paste in these lines:

ArcanaDevelopment.adTempus.Client
ArcanaDevelopment.adTempus.Shared

5. In the Query panel, replace the template code with the following:

'if the adTempus server is on a different computer, replace . with the name
'for example,
'Dim ServerName as String = "remoteservername"
Dim ServerName As String = "."

Sub Main
	Using session = Scheduler.Connect(ServerName, LoginAuthenticationType.Windows, "", "")
		RunSampleCode(session)
	End Using
End Sub

Sub RunSampleCode(session As ArcanaDevelopment.adTempus.Client.Scheduler)
'sample code goes here
End Sub

6. You may wish to save your query at this point to use as a template in the future, to avoid steps 1-4.

Executing Code

This skeleton code connects to the local adTempus server. The code you wish to execute can be placed in the RunSampleCode method, or you can create additional methods and call them instead.

If you are running LINQPad on a computer other than the adTempus server, you need to update line 4 of the code to specify the server name instead of ".".

Use Query > Execute to run your code or refer to the LINQPad online help for information on how to debug your code.