All Classes Namespaces Functions Properties Pages
Sample App

This page describes how to build an application that interacts with the TotalAgility SDK.


App creation


Create a new Console Application in Visual Studio and change the .NET Framework at the top to the latest version (4.5.1 at time of writing):

AppCreate.png

Add references


Next, references to the TotalAgilityFiles need to be added. Open the project and right click on References and choose Add Reference:

AddReferences.png

Click the Browse tab on the left and then the Browse... button. Navigate to the Agility.Server.Web\bin directory under the TotalAgility install and choose:

SelectReferences.png

then click Add. A reference to System.Runtime.Serialization also needs to be added in the same way, and can be found in the Assemblies tab on the left:

AddSystemReference.png

Click on Ok and the new references should be reflected in the list:

HighlightReferences.png

Updating the App.Config file


The App.Config file has all the configuration settings for a project. To connect to TotalAgility some extra settings need to be added.
When you first open the file it will look like:

1 <?xml version="1.0" encoding="utf-8" ?>
2 <configuration>
3  <startup>
4  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
5  </startup>
6 </configuration>

This should be changed to the following:

1 <?xml version="1.0" encoding="utf-8"?>
2 <configuration>
3  <appSettings>
4  <add key="IsMultitenantDeployment" value="false"/>
5  <add key="SdkServicesLocation" value="http://localhost/TotalAgility/Services/SDK"/>
6  </appSettings>
7  <system.serviceModel>
8  <bindings>
9  <basicHttpBinding>
10  <binding name="BasicHttpBinding_Service" closeTimeout="00:01:00"
11  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
12  allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
13  maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
14  messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
15  useDefaultWebProxy="true">
16  <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
17  maxBytesPerRead="4096" maxNameTableCharCount="16384" />
18  <security mode="TransportCredentialOnly">
19  <transport clientCredentialType="Windows" proxyCredentialType="None"
20  realm="" />
21  <message clientCredentialType="UserName" algorithmSuite="Default" />
22  </security>
23  </binding>
24  </basicHttpBinding>
25  </bindings>
26  <client>
27  <endpoint name="SdkCaseServiceEndpoint"
28  binding="basicHttpBinding"
29  bindingConfiguration="BasicHttpBinding_Service"
30  contract="Agility.Sdk.Model.Interfaces.Services.ICaseService"/>
31  <endpoint name="SdkActivityServiceEndpoint"
32  binding="basicHttpBinding"
33  bindingConfiguration="BasicHttpBinding_Service"
34  contract="Agility.Sdk.Model.Interfaces.Services.IActivityService"/>
35  <endpoint name="SdkClientServiceEndpoint"
36  binding="basicHttpBinding"
37  bindingConfiguration="BasicHttpBinding_Service"
38  contract="Agility.Sdk.Model.Interfaces.Services.IClientService"/>
39  <endpoint name="SdkJobServiceEndpoint"
40  binding="basicHttpBinding"
41  bindingConfiguration="BasicHttpBinding_Service"
42  contract="Agility.Sdk.Model.Interfaces.Services.IJobService"/>
43  <endpoint name="SdkProcessServiceEndpoint"
44  binding="basicHttpBinding"
45  bindingConfiguration="BasicHttpBinding_Service"
46  contract="Agility.Sdk.Model.Interfaces.Services.IProcessService"/>
47  <endpoint name="SdkServerServiceEndpoint"
48  binding="basicHttpBinding"
49  bindingConfiguration="BasicHttpBinding_Service"
50  contract="Agility.Sdk.Model.Interfaces.Services.IServerService"/>
51  <endpoint name="SdkTenantServiceEndpoint"
52  binding="basicHttpBinding"
53  bindingConfiguration="BasicHttpBinding_Service"
54  contract="Agility.Sdk.Model.Interfaces.Services.ITenantService"/>
55  <endpoint name="SdkUserServiceEndpoint"
56  binding="basicHttpBinding"
57  bindingConfiguration="BasicHttpBinding_Service"
58  contract="Agility.Sdk.Model.Interfaces.Services.IUserService"/>
59  <endpoint name="SdkResourceServiceEndpoint"
60  binding="basicHttpBinding"
61  bindingConfiguration="BasicHttpBinding_Service"
62  contract="Agility.Sdk.Model.Interfaces.Services.IResourceService"/>
63  <endpoint name="SdkCategoryServiceEndpoint"
64  binding="basicHttpBinding"
65  bindingConfiguration="BasicHttpBinding_Service"
66  contract="Agility.Sdk.Model.Interfaces.Services.ICategoryService"/>
67  <endpoint name="SdkSecurityServiceEndpoint"
68  binding="basicHttpBinding"
69  bindingConfiguration="BasicHttpBinding_Service"
70  contract="Agility.Sdk.Model.Interfaces.Services.ISecurityService"/>
71  <endpoint name="SdkBusinessCalendarServiceEndpoint"
72  binding="basicHttpBinding"
73  bindingConfiguration="BasicHttpBinding_Service"
74  contract="Agility.Sdk.Model.Interfaces.Services.IBusinessCalendarService"/>
75  <endpoint name="SdkDynamicResourceServiceEndpoint"
76  binding="basicHttpBinding"
77  bindingConfiguration="BasicHttpBinding_Service"
78  contract="Agility.Sdk.Model.Interfaces.Services.IDynamicResourceService"/>
79  <endpoint name="SdkCaptureDocumentServiceEndpoint"
80  binding="basicHttpBinding"
81  bindingConfiguration="BasicHttpBinding_Service"
82  contract="Agility.Sdk.Model.Interfaces.Services.ICaptureDocumentService"/>
83  <endpoint name="SdkCaptureProjectServiceEndpoint"
84  binding="basicHttpBinding"
85  bindingConfiguration="BasicHttpBinding_Service"
86  contract="Agility.Sdk.Model.Interfaces.Services.ICaptureProjectService"/>
87  <endpoint name="SdkCaptureKfsServiceEndpoint"
88  binding="basicHttpBinding"
89  bindingConfiguration="BasicHttpBinding_Service"
90  contract="Agility.Sdk.Model.Interfaces.Services.ICaptureKfsService"/>
91  <endpoint name="SdkAssetServiceEndpoint"
92  binding="basicHttpBinding"
93  bindingConfiguration="BasicHttpBinding_Service"
94  contract="Agility.Sdk.Model.Interfaces.Services.IAssetService"/>
95  </client>
96  </system.serviceModel>
97 </configuration>

Writing the application


Making calls to the TotalAgility SDK has two parts:

As an example, the first part of any application will be logging on to the system, in this example LogOnWithWindowsAuthentication3 will be used, which logs in the current Windows user.
This method takes an short, indicating the logon protocol, a boolean indicating that the user should be logged on uncondtionally and returns a Session2 object that has the session details.
In order to call the method a UserService object is needed:

TotalAgility.Sdk.UserService userService = new TotalAgility.Sdk.UserService();

Then the call can be made, passing in 7 for the logOnProtocol parameter, indicating a web logon, true for the unconditionalLogOn parameter and setting a new Session2 object equal to the return value:

Agility.Sdk.Model.Users.Session2 session2 = userService.LogOnWithWindowsAuthentication2(7, true);

Once the above has been added the code will look like the following:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TotalAgilitySdkTest
{
class Program
{
static void Main(string[] args)
{
// create a UserService object
TotalAgility.Sdk.UserService userService = new TotalAgility.Sdk.UserService();
// call Logon2 and capture the result in a new Session2 object
Agility.Sdk.Model.Users.Session2 session2 = userService.LogOnWithWindowsAuthentication2(7, true);
}
}
}