/// <summary> /// Loads from json. /// </summary> /// <param name="jsonProperty">The json property.</param> /// <param name="service"></param> internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { base.LoadFromJson(jsonProperty, service); foreach (string key in jsonProperty.Keys) { switch (key) { case XmlElementNames.IsContactPhoto: this.isContactPhoto = jsonProperty.ReadAsBool(key); break; case XmlElementNames.Content: if (this.loadToStream != null) { jsonProperty.ReadAsBase64Content(key, this.loadToStream); } else { // If there's a file attachment content handler, use it. Otherwise // load the content into a byte array. // TODO: Should we mark the attachment to indicate that content is stored elsewhere? if (service.FileAttachmentContentHandler != null) { Stream outputStream = service.FileAttachmentContentHandler.GetOutputStream(this.Id); if (outputStream != null) { jsonProperty.ReadAsBase64Content(key, outputStream); } else { this.content = jsonProperty.ReadAsBase64Content(key); } } else { this.content = jsonProperty.ReadAsBase64Content(key); } } 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 XmlAttributeNames.CharacterSet: this.characterSet = jsonProperty.ReadAsString(key); break; case JsonObject.JsonValueString: this.content = jsonProperty.ReadAsBase64Content(key); break; default: break; } } }