For details of how to create a project that uses the TotalAgility SDK please see here.
For this example code will created that logs on to the system and then calls GetResources2 and uses the returned data to call GetResourcesEmailAddresses to retrieve a list of their email addresses.
The code will log the current Windows user in and extract the session id to use in further calls:
To make the call to GetResources2 a ResourceFilter2 object will be created and the search criteria populated.
The test system was set up with two users, TestUser1 and TestUser2. To find these users the SearchText member of the filter will be set to "TestUser":
Next the code will make thwe call to GetResources2 and capture the return data:
The call to GetResourcesEmailAddresses requires a ResourceIdentityCollection which means that some code will be needed to create a new ResourceIdentityCollection and populate it from the ResourceSummaryCollection returned by GetResources2:
The call to GetResourcesEmailAddresses can now be made:
Putting all the code together:
Running the code in Visual Studio gives the following output: