innerCalendar entitycollection will have 2 entities
1 is business hours
2nd one is break
//with entity[1].attributes["duration"] will get break duration.
//temp code
Entity BCalendar = GetCalendar(calendarGuid);
EntityCollection calendarRules = BCalendar.GetAttributeValue<EntityCollection>(CalendarColumnNames.CalendarRules);
var firstRulePattern = calendarRules[0].GetAttributeValue<string>(CalendarColumnNames.Pattern);
Guid innerCalendarId = calendarRules[0].GetAttributeValue<EntityReference>(CalendarColumnNames.InnerCalendarId).Id;
Entity innerCalendar = service.Retrieve(CalendarColumnNames.EntityName, innerCalendarId, new ColumnSet(true));
EntityCollection innnerCalendarRule = innerCalendar.GetAttributeValue<EntityCollection>(CalendarColumnNames.CalendarRules);
var duration = 0;
var offset = 0;
var BreakDuration = 0;
BreakDuration = innerCalendar.GetAttributeValue<EntityCollection>(CalendarColumnNames.CalendarRules).Entities[1].GetAttributeValue<int>(CalendarColumnNames.Duration);
duration = innerCalendar.GetAttributeValue<EntityCollection>(CalendarColumnNames.CalendarRules).Entities[0].GetAttributeValue<int>(CalendarColumnNames.Duration);
offset = innerCalendar.GetAttributeValue<EntityCollection>(CalendarColumnNames.CalendarRules).Entities[0].GetAttributeValue<int>(CalendarColumnNames.Offset);
// temp code
No comments:
Post a Comment