/// <summary> /// Loads from json. /// </summary> /// <param name="jsonProperty">The json property.</param> /// <param name="service"></param> internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { foreach (string key in jsonProperty.Keys) { switch (key) { case XmlElementNames.StartTime: this.startTime = EwsUtilities.ParseAsUnbiasedDatetimescopedToServicetimeZone( jsonProperty.ReadAsString(key), service); break; case XmlElementNames.EndTime: this.endTime = EwsUtilities.ParseAsUnbiasedDatetimescopedToServicetimeZone( jsonProperty.ReadAsString(key), service); break; case XmlElementNames.BusyType: this.freeBusyStatus = jsonProperty.ReadEnumValue <LegacyFreeBusyStatus>(key); break; case XmlElementNames.CalendarEventDetails: this.details = new CalendarEventDetails(); this.details.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; default: break; } } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonProperty">The json property.</param> /// <param name="service">The service.</param> internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { foreach (string key in jsonProperty.Keys) { switch (key) { case XmlElementNames.MeetingTime: this.meetingTime = EwsUtilities.ParseAsUnbiasedDatetimescopedToServicetimeZone(jsonProperty.ReadAsString(key), service); break; case XmlElementNames.IsWorkTime: this.isWorkTime = jsonProperty.ReadAsBool(key); break; case XmlElementNames.SuggestionQuality: this.quality = jsonProperty.ReadEnumValue <SuggestionQuality>(key); break; case XmlElementNames.AttendeeConflictDataArray: object[] jsonConflictArray = jsonProperty.ReadAsArray(key); foreach (object conflictObject in jsonConflictArray) { JsonObject jsonConflict = conflictObject as JsonObject; if (jsonConflict != null) { Conflict conflict = null; switch (jsonConflict.ReadTypeString()) { case XmlElementNames.UnknownAttendeeConflictData: conflict = new Conflict(ConflictType.UnknownAttendeeConflict); break; case XmlElementNames.TooBigGroupAttendeeConflictData: conflict = new Conflict(ConflictType.GroupTooBigConflict); break; case XmlElementNames.IndividualAttendeeConflictData: conflict = new Conflict(ConflictType.IndividualAttendeeConflict); break; case XmlElementNames.GroupAttendeeConflictData: conflict = new Conflict(ConflictType.GroupConflict); break; default: EwsUtilities.Assert( false, "TimeSuggestion.TryReadElementFromJson", string.Format("The {0} element name does not map to any AttendeeConflict descendant.", jsonConflict.ReadTypeString())); // The following line to please the compiler break; } conflict.LoadFromJson(jsonConflict, service); this.conflicts.Add(conflict); } } break; default: break; } } }
/// <summary> /// Reads the element value as date time, assuming it is unbiased (e.g. 2009/01/01T08:00) /// and scoped to service's time zone. /// </summary> /// <returns>The element's value as a DateTime object.</returns> public DateTime ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone() { string elementValue = this.ReadElementValue(); return(EwsUtilities.ParseAsUnbiasedDatetimescopedToServicetimeZone(elementValue, this.Service)); }