/// <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.HasLocationChanged: this.hasLocationChanged = jsonProperty.ReadAsBool(key); break; case XmlElementNames.Location: this.location = jsonProperty.ReadAsString(key); break; case XmlElementNames.HasStartTimeChanged: this.hasStartTimeChanged = jsonProperty.ReadAsBool(key); break; case XmlElementNames.Start: this.start = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; case XmlElementNames.HasEndTimeChanged: this.hasEndTimeChanged = jsonProperty.ReadAsBool(key); break; case XmlElementNames.End: this.end = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; 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.FlagStatus: this.flagStatus = jsonProperty.ReadEnumValue <ItemFlagStatus>(key); break; case XmlElementNames.StartDate: this.startDate = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; case XmlElementNames.DueDate: this.dueDate = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; case XmlElementNames.CompleteDate: this.completeDate = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; default: break; } } }
/// <summary> /// Loads the events from json. /// </summary> /// <param name="jsonEventsArray">The json events array.</param> /// <param name="service">The service.</param> private void LoadEventsFromJson(object[] jsonEventsArray, ExchangeService service) { foreach (JsonObject jsonEvent in jsonEventsArray) { this.newWatermark = jsonEvent.ReadAsString(XmlElementNames.Watermark); EventType eventType = jsonEvent.ReadEnumValue <EventType>(JsonNames.NotificationType); if (eventType == EventType.Status) { continue; } NotificationEvent notificationEvent; if (jsonEvent.ContainsKey(XmlElementNames.FolderId)) { notificationEvent = new FolderEvent( eventType, service.ConvertUniversalDateTimeStringToLocalDateTime(jsonEvent.ReadAsString(XmlElementNames.TimeStamp)).Value); } else { notificationEvent = new ItemEvent( eventType, service.ConvertUniversalDateTimeStringToLocalDateTime(jsonEvent.ReadAsString(XmlElementNames.TimeStamp)).Value); } notificationEvent.LoadFromJson(jsonEvent, service); this.events.Add(notificationEvent); } }
/// <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.ItemId: this.itemId = new ItemId(); this.itemId.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.Start: this.start = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; case XmlElementNames.End: this.end = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; case XmlElementNames.OriginalStart: this.originalStart = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; default: break; } } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonProperty">The json property.</param> /// <param name="service"></param> internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { if (jsonProperty.ContainsKey(XmlElementNames.Start)) { this.originalStart = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(XmlElementNames.Start)).Value; } }
/// <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.IsUndecidedApprovalRequest: this.isUndecidedApprovalRequest = jsonProperty.ReadAsBool(key); break; case XmlElementNames.ApprovalDecision: this.approvalDecision = jsonProperty.ReadAsInt(key); break; case XmlElementNames.ApprovalDecisionMaker: this.approvalDecisionMaker = jsonProperty.ReadAsString(key); break; case XmlElementNames.ApprovalDecisionTime: this.approvalDecisionTime = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; default: break; } } }
/// <summary> /// Loads the property value from json. /// </summary> /// <param name="value">The JSON value. Can be a JsonObject, string, number, bool, array, or null.</param> /// <param name="service">The service.</param> /// <param name="propertyBag">The property bag.</param> internal override void LoadPropertyValueFromJson(object value, ExchangeService service, PropertyBag propertyBag) { string stringValue = value as string; if (!String.IsNullOrEmpty(stringValue)) { propertyBag[this] = service.ConvertUniversalDateTimeStringToLocalDateTime(stringValue); } }
/// <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.StartDateTime: this.start = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)); break; case XmlElementNames.EndDateTime: this.end = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)); break; default: break; } } }
/// <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.AttachmentId: this.LoadAttachmentIdFromJson(jsonProperty.ReadAsJsonObject(key)); break; case XmlElementNames.Name: this.name = jsonProperty.ReadAsString(key); break; case XmlElementNames.ContentType: this.contentType = jsonProperty.ReadAsString(key); break; case XmlElementNames.ContentId: this.contentId = jsonProperty.ReadAsString(key); break; case XmlElementNames.ContentLocation: this.contentLocation = jsonProperty.ReadAsString(key); break; case XmlElementNames.Size: this.size = jsonProperty.ReadAsInt(key); break; case XmlElementNames.LastModifiedTime: this.lastModifiedTime = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value; break; case XmlElementNames.IsInline: this.isInline = jsonProperty.ReadAsBool(key); break; default: break; } } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonObject">The json object.</param> /// <param name="service">The service.</param> internal void LoadFromJson(JsonObject jsonObject, ExchangeService service) { this.startTime = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonObject.ReadAsString(XmlElementNames.StartTime)).Value; this.endTime = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonObject.ReadAsString(XmlElementNames.EndTime)).Value; }
/// <summary> /// Constructs a dictionary object (key or entry value) from the specified type and string list. /// </summary> /// <param name="type">Object type to construct.</param> /// <param name="value">Value of the dictionary object as a string list</param> /// <param name="service">The service.</param> /// <returns>Dictionary object.</returns> private object ConstructObject( UserConfigurationDictionaryObjectType type, List <string> value, ExchangeService service) { EwsUtilities.Assert( value != null, "UserConfigurationDictionary.ConstructObject", "value is null"); EwsUtilities.Assert( (value.Count == 1 || type == UserConfigurationDictionaryObjectType.StringArray), "UserConfigurationDictionary.ConstructObject", "value is array but type is not StringArray"); object dictionaryObject = null; switch (type) { case UserConfigurationDictionaryObjectType.Boolean: dictionaryObject = bool.Parse(value[0]); break; case UserConfigurationDictionaryObjectType.Byte: dictionaryObject = byte.Parse(value[0]); break; case UserConfigurationDictionaryObjectType.ByteArray: dictionaryObject = Convert.FromBase64String(value[0]); break; case UserConfigurationDictionaryObjectType.DateTime: DateTime?dateTime = service.ConvertUniversalDateTimeStringToLocalDateTime(value[0]); if (dateTime.HasValue) { dictionaryObject = dateTime.Value; } else { EwsUtilities.Assert( false, "UserConfigurationDictionary.ConstructObject", "DateTime is null"); } break; case UserConfigurationDictionaryObjectType.Integer32: dictionaryObject = int.Parse(value[0]); break; case UserConfigurationDictionaryObjectType.Integer64: dictionaryObject = long.Parse(value[0]); break; case UserConfigurationDictionaryObjectType.String: dictionaryObject = value[0]; break; case UserConfigurationDictionaryObjectType.StringArray: dictionaryObject = value.ToArray(); break; case UserConfigurationDictionaryObjectType.UnsignedInteger32: dictionaryObject = uint.Parse(value[0]); break; case UserConfigurationDictionaryObjectType.UnsignedInteger64: dictionaryObject = ulong.Parse(value[0]); break; default: EwsUtilities.Assert( false, "UserConfigurationDictionary.ConstructObject", "Type not recognized: " + type.ToString()); break; } return(dictionaryObject); }
/// <summary> /// Reads response elements from Json. /// </summary> /// <param name="responseObject">The response object.</param> /// <param name="service">The service.</param> internal override void ReadElementsFromJson(JsonObject responseObject, ExchangeService service) { base.ReadElementsFromJson(responseObject, service); this.passwordExpirationDate = service.ConvertUniversalDateTimeStringToLocalDateTime(responseObject.ReadAsString(XmlElementNames.PasswordExpirationDate)).Value; }