/// <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.OofState: this.state = jsonProperty.ReadEnumValue <OofState>(key); break; case XmlElementNames.ExternalAudience: this.externalAudience = jsonProperty.ReadEnumValue <OofExternalAudience>(key); break; case XmlElementNames.Duration: this.duration = new TimeWindow(); this.duration.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.InternalReply: this.internalReply = new OofReply(); this.internalReply.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.ExternalReply: this.externalReply = new OofReply(); this.externalReply.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; default: break; } } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonEvent">The json event.</param> /// <param name="service">The service.</param> internal override void LoadFromJson(JsonObject jsonEvent, ExchangeService service) { this.folderId = new FolderId(); this.folderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.FolderId), service); this.ParentFolderId = new FolderId(); this.ParentFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.ParentFolderId), service); switch (this.EventType) { case EventType.Moved: case EventType.Copied: this.oldFolderId = new FolderId(); this.oldFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(JsonNames.OldFolderId), service); this.OldParentFolderId = new FolderId(); this.OldParentFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.OldParentFolderId), service); break; case EventType.Modified: if (jsonEvent.ContainsKey(XmlElementNames.UnreadCount)) { this.unreadCount = jsonEvent.ReadAsInt(XmlElementNames.UnreadCount); } 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.BaseOffset: this.baseOffset = EwsUtilities.XSDurationToTimeSpan(jsonProperty.ReadAsString(key)); break; case XmlElementNames.Standard: this.standard = new TimeChange(); this.standard.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.Daylight: this.daylight = new TimeChange(); this.daylight.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlAttributeNames.TimeZoneName: this.name = 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.UserId: this.userId = new UserId(); this.userId.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.DelegatePermissions: this.permissions.Reset(); this.permissions.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.ReceiveCopiesOfMeetingMessages: this.receiveCopiesOfMeetingMessages = jsonProperty.ReadAsBool(key); break; case XmlElementNames.ViewPrivateItems: this.viewPrivateItems = jsonProperty.ReadAsBool(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.Bias: this.bias = TimeSpan.FromMinutes(jsonProperty.ReadAsInt(key)); break; case XmlElementNames.StandardTime: this.standardTime = new LegacyAvailabilityTimeZoneTime(); this.standardTime.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.DaylightTime: this.daylightTime = new LegacyAvailabilityTimeZoneTime(); this.daylightTime.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; default: break; } } }
/// <summary> /// Builds the response object from json. /// </summary> /// <param name="jsonResponse">The json response.</param> /// <returns></returns> protected object BuildResponseObjectFromJson(JsonObject jsonResponse) { if (jsonResponse.ContainsKey("Header")) { this.ReadSoapHeader(jsonResponse.ReadAsJsonObject("Header")); } return(this.ParseResponse(jsonResponse.ReadAsJsonObject(XmlElementNames.SOAPBodyElementName))); }
/// <summary> /// Loads from json collection. /// </summary> /// <param name="jsonCollection">The json collection.</param> /// <param name="service">The service.</param> public void CreateFromJsonCollection(object[] jsonCollection, ExchangeService service) { foreach (object element in jsonCollection) { JsonObject jsonEntry = element as JsonObject; object parsedKey = this.GetDictionaryObject(jsonEntry.ReadAsJsonObject(XmlElementNames.DictionaryKey), service); object parsedValue = this.GetDictionaryObject(jsonEntry.ReadAsJsonObject(XmlElementNames.DictionaryValue), service); this.dictionary.Add(parsedKey, parsedValue); } }
/// <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.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> /// Reads the SOAP fault. /// </summary> /// <param name="jsonSoapFault">The json SOAP fault.</param> /// <returns></returns> private SoapFaultDetails ReadSoapFault(JsonObject jsonSoapFault) { SoapFaultDetails soapFaultDetails = null; if (jsonSoapFault.ContainsKey("Header")) { this.ReadSoapHeader(jsonSoapFault.ReadAsJsonObject("Header")); } if (jsonSoapFault.ContainsKey("Body")) { soapFaultDetails = SoapFaultDetails.Parse(jsonSoapFault.ReadAsJsonObject("Body")); } return(soapFaultDetails); }
/// <summary> /// Read SOAP header and extract server version /// </summary> /// <param name="jsonHeader">The json header.</param> private void ReadSoapHeader(JsonObject jsonHeader) { if (jsonHeader.ContainsKey(XmlElementNames.ServerVersionInfo)) { this.Service.ServerInfo = ExchangeServerInfo.Parse(jsonHeader.ReadAsJsonObject(XmlElementNames.ServerVersionInfo)); } }
/// <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.LocationDisplayName: this.displayName = jsonProperty.ReadAsString(key); break; case XmlElementNames.LocationAnnotation: this.annotation = jsonProperty.ReadAsString(key); break; case XmlElementNames.PersonaPostalAddress: this.personaPostalAddress = new PersonaPostalAddress(); this.personaPostalAddress.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); this.personaPostalAddress.OnChange += new ComplexPropertyChangedDelegate(PersonaPostalAddress_OnChange); break; default: break; } } }
/// <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) { JsonObject rootFolder = responseObject.ReadAsJsonObject(XmlElementNames.RootFolder); this.results.TotalCount = rootFolder.ReadAsInt(XmlAttributeNames.TotalItemsInView); this.results.MoreAvailable = rootFolder.ReadAsBool(XmlAttributeNames.IncludesLastItemInRange); // Ignore IndexedPagingOffset attribute if MoreAvailable is false. if (results.MoreAvailable) { if (rootFolder.ContainsKey(XmlAttributeNames.IndexedPagingOffset)) { this.results.NextPageOffset = rootFolder.ReadAsInt(XmlAttributeNames.IndexedPagingOffset); } else { this.results.NextPageOffset = null; } } if (rootFolder.ContainsKey(XmlElementNames.Folders)) { List <Folder> folders = new EwsServiceJsonReader(service).ReadServiceObjectsCollectionFromJson <Folder>( rootFolder, XmlElementNames.Folders, this.CreateFolderInstance, true, /* clearPropertyBag */ this.propertySet, /* requestedPropertySet */ true); /* summaryPropertiesOnly */ folders.ForEach((folder) => this.results.Folders.Add(folder)); } }
/// <summary> /// Parses the response. /// </summary> /// <param name="jsonBody">The json body.</param> /// <returns>Response object.</returns> internal override object ParseResponse(JsonObject jsonBody) { ServiceResponseCollection <TResponse> serviceResponses = new ServiceResponseCollection <TResponse>(); object[] jsonResponseMessages = jsonBody.ReadAsJsonObject(XmlElementNames.ResponseMessages).ReadAsArray(XmlElementNames.Items); int responseCtr = 0; foreach (object jsonResponseObject in jsonResponseMessages) { TResponse response = this.CreateServiceResponse(this.Service, responseCtr); response.LoadFromJson(jsonResponseObject as JsonObject, this.Service); // Add the response to the list after it has been deserialized because the response // list updates an overall result as individual responses are added to it. serviceResponses.Add(response); responseCtr++; } if (serviceResponses.Count < this.GetExpectedResponseMessageCount()) { if ((serviceResponses.Count == 1) && (serviceResponses[0].Result == ServiceResult.Error)) { throw new ServiceResponseException(serviceResponses[0]); } else { throw new ServiceJsonDeserializationException(); } } return(serviceResponses); }
/// <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) { base.LoadFromJson(jsonProperty, service); this.value = jsonProperty.ReadAsJsonObject(XmlElementNames.Constant).ReadAsString(XmlElementNames.Value); this.containmentMode = jsonProperty.ReadEnumValue <ContainmentMode>(XmlAttributeNames.ContainmentMode); this.comparisonMode = jsonProperty.ReadEnumValue <ComparisonMode>(XmlAttributeNames.ContainmentComparison); }
/// <summary> /// Reads response elements from Json. /// </summary> /// <param name="responseObject">Json response object</param> /// <param name="service">Exchange service</param> internal override void ReadElementsFromJson(JsonObject responseObject, ExchangeService service) { base.ReadElementsFromJson(responseObject, service); if (responseObject.ContainsKey(XmlElementNames.Token)) { this.MovedItemId = new ItemId(); this.MovedItemId.LoadFromJson(responseObject.ReadAsJsonObject(XmlElementNames.MovedItemId), service); } }
/// <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) { JsonObject jsonRecurrence = value as JsonObject; JsonObject jsonPattern = jsonRecurrence.ReadAsJsonObject(JsonNames.RecurrencePattern); Recurrence recurrence = GetRecurrenceFromString(jsonPattern.ReadTypeString()); recurrence.LoadFromJson(jsonPattern, service); JsonObject jsonRange = jsonRecurrence.ReadAsJsonObject(JsonNames.RecurrenceRange); RecurrenceRange range = GetRecurrenceRange(jsonRange.ReadTypeString()); range.LoadFromJson(jsonRange, service); range.SetupRecurrence(recurrence); propertyBag[this] = recurrence; }
/// <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) { base.LoadFromJson(jsonProperty, service); foreach (string key in jsonProperty.Keys) { switch (key) { case XmlElementNames.To: string targetKind = jsonProperty.ReadAsJsonObject(key).ReadAsString(XmlAttributeNames.Kind); string targetId = jsonProperty.ReadAsJsonObject(key).ReadAsString(XmlElementNames.Value); switch (targetKind) { case TimeZoneTransition.PeriodTarget: if (!this.timeZoneDefinition.Periods.TryGetValue(targetId, out this.targetPeriod)) { throw new ServiceLocalException( string.Format( Strings.PeriodNotFound, targetId)); } break; case TimeZoneTransition.GroupTarget: if (!this.timeZoneDefinition.TransitionGroups.TryGetValue(targetId, out this.targetGroup)) { throw new ServiceLocalException( string.Format( Strings.TransitionGroupNotFound, targetId)); } break; default: throw new ServiceLocalException(Strings.UnsupportedTimeZonePeriodTransitionTarget); } 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.UserId: this.UserId = new UserId(); this.UserId.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.CanCreateItems: this.canCreateItems = jsonProperty.ReadAsBool(key); break; case XmlElementNames.CanCreateSubFolders: this.canCreateSubFolders = jsonProperty.ReadAsBool(key); break; case XmlElementNames.IsFolderOwner: this.isFolderOwner = jsonProperty.ReadAsBool(key); break; case XmlElementNames.IsFolderVisible: this.isFolderVisible = jsonProperty.ReadAsBool(key); break; case XmlElementNames.IsFolderContact: this.isFolderContact = jsonProperty.ReadAsBool(key); break; case XmlElementNames.EditItems: this.editItems = jsonProperty.ReadEnumValue <PermissionScope>(key); break; case XmlElementNames.DeleteItems: this.deleteItems = jsonProperty.ReadEnumValue <PermissionScope>(key); break; case XmlElementNames.ReadItems: this.readItems = jsonProperty.ReadEnumValue <FolderPermissionReadAccess>(key); break; case XmlElementNames.PermissionLevel: case XmlElementNames.CalendarPermissionLevel: this.permissionLevel = jsonProperty.ReadEnumValue <FolderPermissionLevel>(key); break; default: break; } } this.AdjustPermissionLevel(); }
/// <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); if (responseObject.ContainsKey(XmlElementNames.MailboxHoldResult)) { JsonObject jsonMailboxHold = responseObject.ReadAsJsonObject(XmlElementNames.MailboxHoldResult); this.holdResult = MailboxHoldResult.LoadFromJson(jsonMailboxHold); } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonProperty">The json property.</param> /// <param name="service">The service.</param> internal void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { foreach (string key in jsonProperty.Keys) { switch (key) { case XmlElementNames.Mailbox: this.mailbox.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.Contact: this.contact = new Contact(this.owner.Session); this.contact.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service, true, PropertySet.FirstClassProperties, false); break; default: break; } } }
/// <summary> /// Loads from json. /// </summary> /// <param name="responseObject">The response object.</param> /// <param name="service">The service.</param> internal void LoadFromJson(JsonObject responseObject, ExchangeService service) { foreach (string key in responseObject.Keys) { switch (key) { case XmlElementNames.UserConfigurationName: JsonObject jsonUserConfigName = responseObject.ReadAsJsonObject(key); string responseName = jsonUserConfigName.ReadAsString(XmlAttributeNames.Name); EwsUtilities.Assert( string.Compare(this.name, responseName, StringComparison.Ordinal) == 0, "UserConfiguration.LoadFromJson", "UserConfigurationName does not match: Expected: " + this.name + " Name in response: " + responseName); break; case XmlElementNames.ItemId: this.itemId = new ItemId(); this.itemId.LoadFromJson(responseObject.ReadAsJsonObject(key), service); break; case XmlElementNames.Dictionary: ((IJsonCollectionDeserializer)this.dictionary).CreateFromJsonCollection(responseObject.ReadAsArray(key), service); break; case XmlElementNames.XmlData: this.xmlData = Convert.FromBase64String(responseObject.ReadAsString(key)); break; case XmlElementNames.BinaryData: this.binaryData = Convert.FromBase64String(responseObject.ReadAsString(key)); break; default: break; } } }
/// <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); if (responseObject.ContainsKey(XmlElementNames.Token)) { JsonObject jsonObject = responseObject.ReadAsJsonObject(XmlElementNames.Token); this.Id = jsonObject.ReadAsString(XmlElementNames.Id); this.TokenType = (ClientAccessTokenType)Enum.Parse(typeof(ClientAccessTokenType), jsonObject.ReadAsString(XmlElementNames.TokenType)); this.TokenValue = jsonObject.ReadAsString(XmlElementNames.TokenValue); this.TTL = jsonObject.ReadAsInt(XmlElementNames.TTL); } }
/// <summary> /// Parses the response. /// See O15:324151 on why we need to override ParseResponse here instead of calling the one in MultiResponseServiceRequest.cs /// </summary> /// <param name="jsonBody">The json body.</param> /// <returns>Response object.</returns> internal override object ParseResponse(JsonObject jsonBody) { ServiceResponseCollection <SearchMailboxesResponse> serviceResponses = new ServiceResponseCollection <SearchMailboxesResponse>(); object[] jsonResponseMessages = jsonBody.ReadAsJsonObject(XmlElementNames.ResponseMessages).ReadAsArray(XmlElementNames.Items); foreach (object jsonResponseObject in jsonResponseMessages) { SearchMailboxesResponse response = new SearchMailboxesResponse(); response.LoadFromJson(jsonResponseObject as JsonObject, this.Service); serviceResponses.Add(response); } return(serviceResponses); }
/// <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) { base.LoadFromJson(jsonProperty, service); JsonObject jsonFieldUriOrConstant = jsonProperty.ReadAsJsonObject(XmlElementNames.FieldURIOrConstant).ReadAsJsonObject(XmlElementNames.Item); if (jsonFieldUriOrConstant.ReadTypeString() == XmlElementNames.Constant) { this.value = jsonFieldUriOrConstant[XmlElementNames.Value]; } else { this.otherPropertyDefinition = PropertyDefinitionBase.TryLoadFromJson(jsonProperty); } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonEvent">The json event.</param> /// <param name="service">The service.</param> internal override void LoadFromJson(JsonObject jsonEvent, ExchangeService service) { this.itemId = new ItemId(); this.itemId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.ItemId), service); this.ParentFolderId = new FolderId(); this.ParentFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.ParentFolderId), service); switch (this.EventType) { case EventType.Moved: case EventType.Copied: this.oldItemId = new ItemId(); this.oldItemId.LoadFromJson(jsonEvent.ReadAsJsonObject(JsonNames.OldItemId), service); this.OldParentFolderId = new FolderId(); this.OldParentFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.OldParentFolderId), 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) { this.ConversationId = new ConversationId(); this.ConversationId.LoadFromJson(jsonProperty.ReadAsJsonObject(XmlElementNames.ConversationId), service); if (jsonProperty.ContainsKey(XmlElementNames.SyncState)) { this.SyncState = jsonProperty.ReadAsString(XmlElementNames.SyncState); } this.ConversationNodes = new ConversationNodeCollection(this.propertySet); ((IJsonCollectionDeserializer)this.ConversationNodes).CreateFromJsonCollection( jsonProperty.ReadAsArray(XmlElementNames.ConversationNodes), service); }
/// <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); if (responseObject.ContainsKey(XmlElementNames.RootItemId)) { JsonObject jsonRootItemId = responseObject.ReadAsJsonObject(XmlElementNames.RootItemId); string changeKey; if (jsonRootItemId.ContainsKey(XmlAttributeNames.RootItemChangeKey) && !String.IsNullOrEmpty(changeKey = jsonRootItemId.ReadAsString(XmlAttributeNames.RootItemChangeKey)) && this.attachment.Owner != null) { this.attachment.Owner.RootItemId.ChangeKey = changeKey; } } }
/// <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="jsonProperty">The json property.</param> /// <param name="service"></param> internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { base.LoadFromJson(jsonProperty, service); if (jsonProperty.ContainsKey(XmlElementNames.Item)) { JsonObject jsonItem = jsonProperty.ReadAsJsonObject(XmlElementNames.Item); // skip this - "Item" : null if (jsonItem != null) { this.item = EwsUtilities.CreateItemFromXmlElementName(this, jsonItem.ReadTypeString()); if (this.item != null) { this.item.LoadFromJson(jsonItem, service, true /* clearPropertyBag */); } } } }