Cisco Cisco TelePresence Management Suite (TMS) Version 15 Developer's Guide

Page of 66
Code Examples
This chapter provides examples of how to apply the remote setup API and the booking API in your development.
Code examples are provided in C#.
Remote Setup API Examples
The code snippet below demonstrates how to authenticate with the remote setup API.
public
 
void
 InitRemoteSetupService()
 {
     
// Specify username and password to authenticate to service.
     
// (Can also be done in web.config) 
     
var
 credentials = 
new
 NetworkCredential(
Username
Password
Server
);
 
     remoteSetupService = 
new
 RemoteSetupService { Credentials = credentials };            
     
if
 (remoteSetupService.ExternalAPIVersionSoapHeaderValue == 
null
)
     {
         remoteSetupService.ExternalAPIVersionSoapHeaderValue = 
new
 RemoteSetupServiceWS.ExternalAPIVersionSoapHeader();
     }
     remoteSetupService.ExternalAPIVersionSoapHeaderValue.ClientVersionIn = 16;
 }
The code snippet below demonstrates how to loop through all systems in Cisco TMS, and display information about 
each system.
public
 
void
 DisplaySystemInformation()
 {
     InitRemoteSetupService();
     
// Get all systems from TMS 
     
var
 tmsSystems = remoteSetupService.GetSystems(); 
     
// Loop through the systems and output information about each system 
     
foreach
 (RemoteSetupServiceWS.TMSSystem tmsSystem 
in
 tmsSystems)
     {
         Console.Out.WriteLine(
"SystemId: "
 + tmsSystem + 
" System Name:"
 + tmsSystem.SystemName);
     }            
 }
Cisco Systems, Inc.
57