An example of how the class can be used is given below.
ExpandCalendarRequest expandCalendarRequest = new ExpandCalendarRequest();
expandCalendarRequest.CalendarId = calendarId;
expandCalendarRequest.Start = startDate;
expandCalendarRequest.End = endDate;
ExpandCalendarResponse expandCalendarResponse = (ExpandCalendarResponse)organizationService.Execute(expandCalendarRequest);
CalenderId can be found from the resource record. Each resource is assigned a calendar. This is not visible on the form. But the field is there to be accessed.
Startdate and end date defines the time period we want to check the availability of the resource.
Response that comes in the form of ExpandCalendarResponse class. This returns timeinfo object. Properties of this class can be found in this link.
From the properties we can get the start time for each day and their availability. Availability can found from 2 properties. They are given below.
- TimeCode
- Available - The time is available within the working hours of the resource. Value = 0.
- Busy - The time is committed to an activity. Value = 1
- Filter - Use additional filters for the time block such as service cost or service start time. Value = 3.
- Unavailable - The time is unavailable. Value = 2.
- Subcode
- Appointment - A block of time that is already scheduled for an appointment. Value = 7.
- Break - A block of time that cannot be committed due to a scheduled break. Value = 4.
- Committed - A block of time that is committed to perform an action. Value = 2.
- Holiday - A block of time that cannot be scheduled due to a scheduled holiday. Value = 5.
- ResourceCapacity - Specifies the capacity of a resource for the specified time interval. Value = 10.
- ResourceServiceRestriction - A restriction for a resource for the specified service. Value = 9.
- ResourceStartTime - Specifies to filter a resource start time. Value = 8.
- Schedulable - A schedulable block of time. Value = 1.
- ServiceCost - An override to the service cost for the specified time block. Value = 12.
- ServiceRestriction - Specifies that a service is restricted during the specified block of time. Value = 11.
- Uncommitted - A block of time that is tentatively scheduled but not committed. Value = 3.
- Unspecified - Specifies free time with no specified restrictions. Value = 0.
- Vacation - A block of time that cannot be scheduled due to a scheduled vacation. Value = 6.