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

Page of 66
         PatternEndType = RecurrenceEndType.EndByInstances,
         PatternInstances = 10,
     };
 
     conference.ConferenceTimeZoneRules = 
new
[]
     {
         
new
 TimeZoneRule
            {                                                           
                 Id = 
"My custom rule"
,
                 BaseOffsetInMinutes = 60,
                 DaylightOffsetInMinutes = 60,
                 ValidFrom = DateTime.MinValue,
                 Daylight = 
new
 TimeChange
                 {
                     ChangeSecondAtDay = 2*60*60, 
// Daylight changes at 02:00 am
                     AbsoluteRule = 
new
 TimeChangeAbsoluteRule
                     {
                         Month = 3,
                         DayOfMonth = 3,
                     }
                 },
                 Standard = 
new
 TimeChange
                 {
                     ChangeSecondAtDay = 10*60*60, 
//// Daylight changes at 10:00 am
                     RelativeRule = 
new
 TimeChangeRelativeRule
                     {
                         Month = 10,
                         DayOfTheWeek = 0, 
// Sunday
                         WeekOfTheMonthIndex = 5, 
// Last
                     }
                 }
             }
     };
     conference = bookingService.SaveConference(conference);
 
     PrintConferenceInformation(conference);
 }
Error Handling Examples
The following code examples demonstrate how to handle errors generated from API calls.
Conference in the Past
Running this code will output the message: "You cannot book a conference in the past".
public
 
void
 ErrorHandling_BookInThePast()
 {
     InitBookingService();
     
var
 conference = bookingService.GetDefaultConference();
     
var
 start = DateTime.Now.AddHours(-10);
     
var
 end = start.AddMinutes(10);
 
     conference.StartTimeUTC = start.ToString(
"u"
);
     conference.EndTimeUTC = end.ToString(
"u"
);
 
     
try
     {
         conference = bookingService.SaveConference(conference);
     }
     
catch
 (SoapException e)
     {
         Console.WriteLine(
"Got error with error code {0}, and message {1}, from Booking API"
, e.Detail.InnerXml, e.Message);
     }
63
Cisco TelePresence Management Suite Extension Booking API  Programming Reference Guide