/// <summary> /// Load from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void InternalLoadFromXml(EwsServiceXmlReader reader) { base.InternalLoadFromXml(reader); this.itemId = new ItemId(); this.itemId.LoadFromXml(reader, reader.LocalName); reader.Read(); this.ParentFolderId = new FolderId(); this.ParentFolderId.LoadFromXml(reader, XmlElementNames.ParentFolderId); switch (this.EventType) { case EventType.Moved: case EventType.Copied: reader.Read(); this.oldItemId = new ItemId(); this.oldItemId.LoadFromXml(reader, reader.LocalName); reader.Read(); this.OldParentFolderId = new FolderId(); this.OldParentFolderId.LoadFromXml(reader, reader.LocalName); break; default: break; } }
/// <summary> /// Load from xml /// </summary> /// <param name="reader">The reader</param> /// <returns>List of non indexable item statistic object</returns> internal static List<NonIndexableItemStatistic> LoadFromXml(EwsServiceXmlReader reader) { List<NonIndexableItemStatistic> results = new List<NonIndexableItemStatistic>(); reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemStatistics)) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.NonIndexableItemStatistic)) { string mailbox = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Mailbox); int itemCount = reader.ReadElementValue<int>(XmlNamespace.Types, XmlElementNames.ItemCount); string errorMessage = null; if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ErrorMessage)) { errorMessage = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ErrorMessage); } results.Add(new NonIndexableItemStatistic { Mailbox = mailbox, ItemCount = itemCount, ErrorMessage = errorMessage }); } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemStatistics)); } return results; }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { this.searchableMailboxes.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.SearchableMailboxes); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailbox)) { this.searchableMailboxes.Add(SearchableMailbox.LoadFromXml(reader)); } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.SearchableMailboxes)); } reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FailedMailboxes)) { this.FailedMailboxes = FailedSearchMailbox.LoadFailedMailboxesXml(XmlNamespace.Messages, reader); } }
void ReadElementsFromXml(EwsServiceXmlReader reader) { this.ClientExtensions.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions); if (!reader.IsEmptyElement) { // Because we don't have an element for count of returned object, // we have to test the element to determine if it is StartElement of return object or EndElement reader.Read(); while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ClientExtension)) { ClientExtension clientExtension = new ClientExtension(); clientExtension.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.ClientExtension); this.ClientExtensions.Add(clientExtension); reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.ClientExtension); reader.Read(); } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions); } reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionRawMasterTableXml)) { this.rawMasterTableXml = reader.ReadElementValue(); } }
void ReadElementsFromXml(EwsServiceXmlReader reader) { this.searchableMailboxes.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.SearchableMailboxes); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailbox)) { this.searchableMailboxes.Add(SearchableMailbox.LoadFromXml(reader)); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.SearchableMailboxes)); } reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FailedMailboxes)) { this.FailedMailboxes = FailedSearchMailbox.LoadFailedMailboxesXml(XmlNamespace.Messages, reader); } }
void ReadElementsFromXml(EwsServiceXmlReader reader) { if (this.ErrorCode == ServiceError.NoError) { this.delegateUserResponses = new Collection <DelegateUserResponse>(); reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages)) { int delegateUserIndex = 0; do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.DelegateUserResponseMessageType)) { DelegateUser delegateUser = null; if (this.readDelegateUsers && (this.delegateUsers != null)) { delegateUser = this.delegateUsers[delegateUserIndex]; } DelegateUserResponse delegateUserResponse = new DelegateUserResponse(readDelegateUsers, delegateUser); delegateUserResponse.LoadFromXml(reader, XmlElementNames.DelegateUserResponseMessageType); this.delegateUserResponses.Add(delegateUserResponse); delegateUserIndex++; } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages)); } } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { this.Rooms.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Rooms); if (!reader.IsEmptyElement) { // Because we don't have an element for count of returned object, // we have to test the element to determine if it is StartElement of return object or EndElement reader.Read(); while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Room)) { reader.Read(); // skip the start <Room> EmailAddress emailAddress = new EmailAddress(); emailAddress.LoadFromXml(reader, XmlElementNames.RoomId); this.Rooms.Add(emailAddress); reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Room); reader.Read(); } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.Rooms); } }
void ReadElementsFromXml(EwsServiceXmlReader reader) { this.Rooms.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Rooms); if (!reader.IsEmptyElement) { // Because we don't have an element for count of returned object, // we have to test the element to determine if it is StartElement of return object or EndElement reader.Read(); while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Room)) { reader.Read(); // skip the start <Room> EmailAddress emailAddress = new EmailAddress(); emailAddress.LoadFromXml(reader, XmlElementNames.RoomId); this.Rooms.Add(emailAddress); reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Room); reader.Read(); } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.Rooms); } }
/// <summary> /// Load from xml /// </summary> /// <param name="reader">The reader</param> /// <returns>List of non indexable item statistic object</returns> static List <NonIndexableItemStatistic> LoadFromXml(EwsServiceXmlReader reader) { List <NonIndexableItemStatistic> results = new List <NonIndexableItemStatistic>(); reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemStatistics)) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.NonIndexableItemStatistic)) { String mailbox = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Mailbox); int itemCount = reader.ReadElementValue <int>(XmlNamespace.Types, XmlElementNames.ItemCount); String errorMessage = null; if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ErrorMessage)) { errorMessage = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ErrorMessage); } results.Add(new NonIndexableItemStatistic { Mailbox = mailbox, ItemCount = itemCount, ErrorMessage = errorMessage }); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemStatistics)); } return(results); }
/// <summary> /// Loads from XML. /// </summary> /// <param name="reader">The reader.</param> void LoadFromXml(EwsServiceXmlReader reader) { EwsUtilities.Assert( reader != null, "UserConfiguration.LoadFromXml", "reader is null"); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.UserConfiguration); reader.Read(); // Position at first property element do { if (reader.NodeType == XmlNodeType.Element) { switch (reader.LocalName) { case XmlElementNames.UserConfigurationName: String responseName = reader.ReadAttributeValue(XmlAttributeNames.Name); EwsUtilities.Assert( string.Compare(this.name, responseName, StringComparison.Ordinal) == 0, "UserConfiguration.LoadFromXml", "UserConfigurationName does not match: Expected: " + this.name + " Name in response: " + responseName); reader.SkipCurrentElement(); break; case XmlElementNames.ItemId: this.itemId = new ItemId(); this.itemId.LoadFromXml(reader, XmlElementNames.ItemId); break; case XmlElementNames.Dictionary: this.dictionary.LoadFromXml(reader, XmlElementNames.Dictionary); break; case XmlElementNames.XmlData: this.xmlData = Convert.FromBase64String(reader.ReadElementValue()); break; case XmlElementNames.BinaryData: this.binaryData = Convert.FromBase64String(reader.ReadElementValue()); break; default: EwsUtilities.Assert( false, "UserConfiguration.LoadFromXml", "Xml element not supported: " + reader.LocalName); break; } } // If XmlData was loaded, read is skipped because GetXmlData positions the reader at the next property. reader.Read(); }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.UserConfiguration)); }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { reader.Read(); this.ruleCollection.OutlookRuleBlobExists = reader.ReadElementValue<bool>( XmlNamespace.Messages, XmlElementNames.OutlookRuleBlobExists); reader.Read(); if (reader.IsStartElement(XmlNamespace.NotSpecified, XmlElementNames.InboxRules)) { this.ruleCollection.LoadFromXml(reader, XmlNamespace.NotSpecified, XmlElementNames.InboxRules); } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { reader.Read(); this.ruleCollection.OutlookRuleBlobExists = reader.ReadElementValue <bool>( XmlNamespace.Messages, XmlElementNames.OutlookRuleBlobExists); reader.Read(); if (reader.IsStartElement(XmlNamespace.NotSpecified, XmlElementNames.InboxRules)) { this.ruleCollection.LoadFromXml(reader, XmlNamespace.NotSpecified, XmlElementNames.InboxRules); } }
/// <summary> /// Loads the free busy view from XML. /// </summary> /// <param name="reader">The reader.</param> /// <param name="viewType">Type of free/busy view.</param> internal void LoadFreeBusyViewFromXml(EwsServiceXmlReader reader, FreeBusyViewType viewType) { reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.FreeBusyView); string viewTypeString = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.FreeBusyViewType); this.viewType = (FreeBusyViewType)Enum.Parse(typeof(FreeBusyViewType), viewTypeString, false); do { reader.Read(); if (reader.IsStartElement()) { switch (reader.LocalName) { case XmlElementNames.MergedFreeBusy: string mergedFreeBusy = reader.ReadElementValue(); for (int i = 0; i < mergedFreeBusy.Length; i++) { this.mergedFreeBusyStatus.Add((LegacyFreeBusyStatus)Byte.Parse(mergedFreeBusy[i].ToString())); } break; case XmlElementNames.CalendarEventArray: do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.CalendarEvent)) { CalendarEvent calendarEvent = new CalendarEvent(); calendarEvent.LoadFromXml(reader, XmlElementNames.CalendarEvent); this.calendarEvents.Add(calendarEvent); } } while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.CalendarEventArray)); break; case XmlElementNames.WorkingHours: this.workingHours = new WorkingHours(); this.workingHours.LoadFromXml(reader, reader.LocalName); break; } } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.FreeBusyView)); }
void ReadElementsFromXml(EwsServiceXmlReader reader) { this.Manifests.Clear(); base.ReadElementsFromXml(reader); reader.Read(XmlNodeType.Element); // We can have a response from Exchange 2013 (first time this API was introduced) // or the newer response, starting in Exchange 2013 SP1, (X-EWS-TargetVersion: 2.5 or above) bool exchange2013Response; if (XmlElementNames.Manifests.Equals(reader.LocalName)) { exchange2013Response = true; } else if (XmlElementNames.Apps.Equals(reader.LocalName)) { exchange2013Response = false; } else { throw new ServiceXmlDeserializationException( string.Format( Strings.UnexpectedElement, EwsUtilities.GetNamespacePrefix(XmlNamespace.Messages), XmlElementNames.Manifests, XmlNodeType.Element, reader.LocalName, reader.NodeType)); } if (!reader.IsEmptyElement) { // Because we don't have an element for count of returned object, // we have to test the element to determine if it is StartElement of return object or EndElement reader.Read(); if (exchange2013Response) { this.ReadFromExchange2013(reader); } else { this.ReadFromExchange2013Sp1(reader); } } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, exchange2013Response ? XmlElementNames.Manifests : XmlElementNames.Apps); }
void LoadFromXml(EwsServiceXmlReader reader, String xmlElementName) { reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup); do { reader.Read(); switch (reader.LocalName) { case XmlElementNames.SmtpAddress: this.SmtpAddress = reader.ReadElementValue <String>(); break; case XmlElementNames.LegacyDN: this.LegacyDN = reader.ReadElementValue <String>(); break; case XmlElementNames.MailboxGuid: this.MailboxGuid = reader.ReadElementValue <String>(); break; case XmlElementNames.DisplayName: this.DisplayName = reader.ReadElementValue <String>(); break; case XmlElementNames.IsFavorite: this.IsFavorite = reader.ReadElementValue <bool>(); break; case XmlElementNames.LastVisitedTimeUtc: this.LastVisitedTimeUtc = reader.ReadElementValue <String>(); break; case XmlElementNames.AccessType: this.AccessType = (UnifiedGroupAccessType)Enum.Parse(typeof(UnifiedGroupAccessType), reader.ReadElementValue <String>(), false); break; case XmlElementNames.ExternalDirectoryObjectId: this.ExternalDirectoryObjectId = reader.ReadElementValue <String>(); break; default: break; } }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup)); // Skip end element reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.UnifiedGroup); reader.Read(); }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { this.ClientExtensions.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions); if (!reader.IsEmptyElement) { // Because we don't have an element for count of returned object, // we have to test the element to determine if it is StartElement of return object or EndElement reader.Read(); while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ClientExtension)) { ClientExtension clientExtension = new ClientExtension(); clientExtension.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.ClientExtension); this.ClientExtensions.Add(clientExtension); reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.ClientExtension); reader.Read(); } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions); } reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionRawMasterTableXml)) { this.rawMasterTableXml = reader.ReadElementValue(); } }
/// <summary> /// Load from xml. /// </summary> /// <param name="reader">The reader.</param> /// <returns>Retention policy tag object.</returns> static RetentionPolicyTag LoadFromXml(EwsServiceXmlReader reader) { reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.RetentionPolicyTag); RetentionPolicyTag retentionPolicyTag = new RetentionPolicyTag(); retentionPolicyTag.DisplayName = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.DisplayName); retentionPolicyTag.RetentionId = new Guid(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.RetentionId)); retentionPolicyTag.RetentionPeriod = reader.ReadElementValue <int>(XmlNamespace.Types, XmlElementNames.RetentionPeriod); retentionPolicyTag.Type = reader.ReadElementValue <ElcFolderType>(XmlNamespace.Types, XmlElementNames.Type); retentionPolicyTag.RetentionAction = reader.ReadElementValue <RetentionActionType>(XmlNamespace.Types, XmlElementNames.RetentionAction); // Description is not a required property. reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Description)) { retentionPolicyTag.Description = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Description); } retentionPolicyTag.IsVisible = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.IsVisible); retentionPolicyTag.OptedInto = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.OptedInto); retentionPolicyTag.IsArchive = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.IsArchive); return(retentionPolicyTag); }
/// <summary> /// Loads from XML. /// </summary> /// <param name="reader">The reader.</param> internal void LoadFromXml(EwsServiceXmlReader reader) { reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Resolution); reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Mailbox); this.mailbox.LoadFromXml(reader, XmlElementNames.Mailbox); reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Contact)) { this.contact = new Contact(this.owner.Session); // Contacts returned by ResolveNames should behave like Contact.Load with FirstClassPropertySet specified. this.contact.LoadFromXml( reader, true, /* clearPropertyBag */ PropertySet.FirstClassProperties, false); /* summaryPropertiesOnly */ reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Resolution); } else { reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.Resolution); } }
bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.UserOptions: if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.VotingOptionData)) { VotingOptionData option = new VotingOptionData(); option.LoadFromXml(reader, reader.LocalName); this.userOptions.Add(option); } }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UserOptions)); } return(true); case XmlElementNames.VotingResponse: this.votingResponse = reader.ReadElementValue <string>(); return(true); default: return(false); } }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.UserOptions: if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.VotingOptionData)) { VotingOptionData option = new VotingOptionData(); option.LoadFromXml(reader, reader.LocalName); this.userOptions.Add(option); } } while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UserOptions)); } return true; case XmlElementNames.VotingResponse: this.votingResponse = reader.ReadElementValue<string>(); return true; default: return false; } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Attachments); if (!reader.IsEmptyElement) { reader.Read(XmlNodeType.Element); if (this.attachment == null) { if (string.Equals(reader.LocalName, XmlElementNames.FileAttachment, StringComparison.OrdinalIgnoreCase)) { this.attachment = new FileAttachment(reader.Service); } else if (string.Equals(reader.LocalName, XmlElementNames.ItemAttachment, StringComparison.OrdinalIgnoreCase)) { this.attachment = new ItemAttachment(reader.Service); } } if (this.attachment != null) { this.attachment.LoadFromXml(reader, reader.LocalName); } reader.ReadEndElement(XmlNamespace.Messages, XmlElementNames.Attachments); } }
/// <summary> /// Read the response from Exchange 2013. /// This method assumes that the reader is currently at the Manifests element. /// </summary> /// <param name="reader">The reader.</param> /* private */ void ReadFromExchange2013Sp1(EwsServiceXmlReader reader) { ////<GetAppManifestsResponse ResponseClass="Success" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> //// <ResponseCode>NoError</ResponseCode> //// <m:Apps xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"> //// <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <--- reader should be at this node at the beginning of the loop //// <t:Metadata> //// <t:EndNodeUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&ver=15&clid=1033&p1=15d0d766d0&p2=4&p3=0&p4=WA&p5=en-US\WA102996382&Scope=2&CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&DeployId=EXHV-4680dom.extest.microsoft.com</t:EndNodeUrl> //// <t:AppStatus>2.3</t:AppStatus> //// <t:ActionUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&ver=15&clid=1033&p1=15d0d766d0&p2=4&p3=0&p4=WA&p5=en-US\WA102996382&Scope=2&CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&DeployId=EXHV-4680dom.extest.microsoft.com</t:ActionUrl> //// </t:Metadata> //// <t:Manifest>[base 64 encoded manifest]</t:Manifest> //// </t:App> //// <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> //// .... //// <m:Apps> <----- reader should be at this node at the end of the loop while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.App)) { ClientApp clientApp = new ClientApp(); clientApp.LoadFromXml(reader, XmlElementNames.App); this.Apps.Add(clientApp); this.Manifests.Add(clientApp.Manifest); reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.App); reader.Read(); } }
bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.TimeZone: LegacyAvailabilityTimeZone legacyTimeZone = new LegacyAvailabilityTimeZone(); legacyTimeZone.LoadFromXml(reader, reader.LocalName); this.timeZone = legacyTimeZone.ToTimeZoneInfo(); return(true); case XmlElementNames.WorkingPeriodArray: List <WorkingPeriod> workingPeriods = new List <WorkingPeriod>(); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.WorkingPeriod)) { WorkingPeriod workingPeriod = new WorkingPeriod(); workingPeriod.LoadFromXml(reader, reader.LocalName); workingPeriods.Add(workingPeriod); } }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.WorkingPeriodArray)); // Availability supports a structure that can technically represent different working // times for each day of the week. This is apparently how the information is stored in // Exchange. However, no client (Outlook, OWA) either will let you specify different // working times for each day of the week, and Outlook won't either honor that complex // structure if it happens to be in Exchange. // So here we'll do what Outlook and OWA do: we'll use the start and end times of the // first working period, but we'll use the week days of all the periods. this.startTime = workingPeriods[0].StartTime; this.endTime = workingPeriods[0].EndTime; for (WorkingPeriod workingPeriod in workingPeriods) { for (DayOfTheWeek dayOfWeek in workingPeriods[0].DaysOfWeek) { if (!this.daysOfTheWeek.Contains(dayOfWeek)) { this.daysOfTheWeek.Add(dayOfWeek); } } } return(true); default: return(false); } }
/// <summary> /// Read Personas from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { EwsUtilities.Assert( this.Results.Personas != null, "FindPeopleResponse.ReadElementsFromXml", "Personas is null."); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.People); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.NodeType == XmlNodeType.Element) { Persona item = EwsUtilities.CreateEwsObjectFromXmlElementName<Persona>(reader.Service, reader.LocalName); if (item == null) { reader.SkipCurrentElement(); } else { // Don't clear propertyBag because all properties have been initialized in the persona constructor. item.LoadFromXml(reader, false, null, false); this.Results.Personas.Add(item); } } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.People)); } reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.TotalNumberOfPeopleInView) && !reader.IsEmptyElement) { this.Results.TotalCount = reader.ReadElementValue<int>(); reader.Read(); } if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FirstMatchingRowIndex) && !reader.IsEmptyElement) { this.Results.FirstMatchingRowIndex = reader.ReadElementValue<int>(); reader.Read(); } if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FirstLoadedRowIndex) && !reader.IsEmptyElement) { this.Results.FirstLoadedRowIndex = reader.ReadElementValue<int>(); reader.Read(); } }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if appropriate element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.TimeZone: LegacyAvailabilityTimeZone legacyTimeZone = new LegacyAvailabilityTimeZone(); legacyTimeZone.LoadFromXml(reader, reader.LocalName); this.timeZone = legacyTimeZone.ToTimeZoneInfo(); return true; case XmlElementNames.WorkingPeriodArray: List<WorkingPeriod> workingPeriods = new List<WorkingPeriod>(); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.WorkingPeriod)) { WorkingPeriod workingPeriod = new WorkingPeriod(); workingPeriod.LoadFromXml(reader, reader.LocalName); workingPeriods.Add(workingPeriod); } } while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.WorkingPeriodArray)); // Availability supports a structure that can technically represent different working // times for each day of the week. This is apparently how the information is stored in // Exchange. However, no client (Outlook, OWA) either will let you specify different // working times for each day of the week, and Outlook won't either honor that complex // structure if it happens to be in Exchange. // So here we'll do what Outlook and OWA do: we'll use the start and end times of the // first working period, but we'll use the week days of all the periods. this.startTime = workingPeriods[0].StartTime; this.endTime = workingPeriods[0].EndTime; foreach (WorkingPeriod workingPeriod in workingPeriods) { foreach (DayOfTheWeek dayOfWeek in workingPeriods[0].DaysOfWeek) { if (!this.daysOfTheWeek.Contains(dayOfWeek)) { this.daysOfTheWeek.Add(dayOfWeek); } } } return true; default: return false; } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Attachments); reader.Read(XmlNodeType.Element); this.attachment.LoadFromXml(reader, reader.LocalName); reader.ReadEndElement(XmlNamespace.Messages, XmlElementNames.Attachments); }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { responseCollection = new ServiceResponseCollection<MailTipsResponseMessage>(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages); if (!reader.IsEmptyElement) { // Because we don't have count of returned objects // test the element to determine if it is return object or EndElement reader.Read(); while (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MailTipsResponseMessageType)) { MailTipsResponseMessage mrm = new MailTipsResponseMessage(); mrm.LoadFromXml(reader, XmlElementNames.MailTipsResponseMessageType); this.responseCollection.Add(mrm); reader.Read(); } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages); } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { responseCollection = new ServiceResponseCollection <MailTipsResponseMessage>(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages); if (!reader.IsEmptyElement) { // Because we don't have count of returned objects // test the element to determine if it is return object or EndElement reader.Read(); while (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MailTipsResponseMessageType)) { MailTipsResponseMessage mrm = new MailTipsResponseMessage(); mrm.LoadFromXml(reader, XmlElementNames.MailTipsResponseMessageType); this.responseCollection.Add(mrm); reader.Read(); } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages); } }
/// <summary> /// Load from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void InternalLoadFromXml(EwsServiceXmlReader reader) { base.InternalLoadFromXml(reader); this.folderId = new FolderId(); this.folderId.LoadFromXml(reader, reader.LocalName); reader.Read(); this.ParentFolderId = new FolderId(); this.ParentFolderId.LoadFromXml(reader, XmlElementNames.ParentFolderId); switch (this.EventType) { case EventType.Moved: case EventType.Copied: reader.Read(); this.oldFolderId = new FolderId(); this.oldFolderId.LoadFromXml(reader, reader.LocalName); reader.Read(); this.OldParentFolderId = new FolderId(); this.OldParentFolderId.LoadFromXml(reader, reader.LocalName); break; case EventType.Modified: reader.Read(); if (reader.IsStartElement()) { reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnreadCount); this.unreadCount = int.Parse(reader.ReadValue()); } break; default: break; } }
void LoadFromXml(EwsServiceXmlReader reader, String xmlElementName) { reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet); do { reader.Read(); switch (reader.LocalName) { case XmlElementNames.FilterType: this.FilterType = (UnifiedGroupsFilterType)Enum.Parse(typeof(UnifiedGroupsFilterType), reader.ReadElementValue(), false); break; case XmlElementNames.TotalGroups: this.TotalGroups = reader.ReadElementValue <int>(); break; case XmlElementNames.GroupsTag: reader.Read(); while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup)) { UnifiedGroup unifiedGroup = new UnifiedGroup(); unifiedGroup.LoadFromXml(reader, XmlElementNames.UnifiedGroup); this.unifiedGroups.Add(unifiedGroup); } // Skip end element. reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsTag); reader.Read(); break; default: break; } }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet)); // Skip end element reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet); reader.Read(); }
/// <summary> /// Read Conversations from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { this.groupsSets.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.GroupsSets); if (!reader.IsEmptyElement) { reader.Read(); while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet)) { UnifiedGroupsSet unifiedGroupsSet = new UnifiedGroupsSet(); unifiedGroupsSet.LoadFromXml(reader, XmlElementNames.UnifiedGroupsSet); this.groupsSets.Add(unifiedGroupsSet); } // Skip end element GroupsSets reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsSets); reader.Read(); } }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">XML reader</param> /// <returns>Whether the element was read</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { while (true) { switch (reader.LocalName) { case XmlElementNames.Name: this.Name = reader.ReadElementValue(); break; case XmlElementNames.EmailAddress: this.Address = reader.ReadElementValue(); // Process the next node before returning. Otherwise, the current </EmailAddress> node // makes ComplexProperty.InternalLoadFromXml think that this ends the outer <EmailAddress> // node, causing the remaining children of the outer EmailAddress node to be skipped. reader.Read(); if (reader.NodeType == System.Xml.XmlNodeType.Element) { continue; } break; case XmlElementNames.RoutingType: this.RoutingType = reader.ReadElementValue(); break; case XmlElementNames.MailboxType: try { this.MailboxType = reader.ReadElementValue <MailboxType>(); } catch (System.Exception) { this.MailboxType = Data.MailboxType.Unknown; } break; case XmlElementNames.ItemId: this.Id = new ItemId(); this.Id.LoadFromXml(reader, reader.LocalName); break; case XmlElementNames.OriginalDisplayName: this.OriginalDisplayName = reader.ReadElementValue(); break; default: return(false); } return(true); } }
/// <summary> /// Load from xml /// </summary> /// <param name="reader">The reader</param> /// <returns>Non indexable item details result object</returns> internal static NonIndexableItemDetailsResult LoadFromXml(EwsServiceXmlReader reader) { NonIndexableItemDetailsResult nonIndexableItemDetailsResult = new NonIndexableItemDetailsResult(); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemDetailsResult); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Items)) { List<NonIndexableItem> nonIndexableItems = new List<NonIndexableItem>(); if (!reader.IsEmptyElement) { do { reader.Read(); NonIndexableItem nonIndexableItem = NonIndexableItem.LoadFromXml(reader); if (nonIndexableItem != null) { nonIndexableItems.Add(nonIndexableItem); } } while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.Items)); nonIndexableItemDetailsResult.Items = nonIndexableItems.ToArray(); } } if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.FailedMailboxes)) { nonIndexableItemDetailsResult.FailedMailboxes = FailedSearchMailbox.LoadFailedMailboxesXml(XmlNamespace.Types, reader); } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemDetailsResult)); return nonIndexableItemDetailsResult; }
/// <summary> /// Loads from XML. /// </summary> /// <param name="reader">The reader.</param> /// <param name="propertyBag">The property bag.</param> internal override void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) { reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Recurrence); Recurrence recurrence = null; reader.Read(XmlNodeType.Element); // This is the pattern element recurrence = GetRecurrenceFromString(reader.LocalName); recurrence.LoadFromXml(reader, reader.LocalName); reader.Read(XmlNodeType.Element); // This is the range element RecurrenceRange range = GetRecurrenceRange(reader.LocalName); range.LoadFromXml(reader, reader.LocalName); range.SetupRecurrence(recurrence); reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.Recurrence); propertyBag[this] = recurrence; }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { base.ReadElementsFromXml(reader); reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MovedItemId)) { this.MovedItemId = new ItemId(); this.MovedItemId.LoadFromXml(reader, XmlNamespace.Messages, XmlElementNames.MovedItemId); reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.MovedItemId); } }
void ReadElementsFromXml(EwsServiceXmlReader reader) { base.ReadElementsFromXml(reader); reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MovedItemId)) { this.MovedItemId = new ItemId(); this.MovedItemId.LoadFromXml(reader, XmlNamespace.Messages, XmlElementNames.MovedItemId); reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.MovedItemId); } }
/// <summary> /// Load from xml /// </summary> /// <param name="reader">The reader</param> /// <returns>Non indexable item details result object</returns> static NonIndexableItemDetailsResult LoadFromXml(EwsServiceXmlReader reader) { NonIndexableItemDetailsResult nonIndexableItemDetailsResult = new NonIndexableItemDetailsResult(); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemDetailsResult); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Items)) { List <NonIndexableItem> nonIndexableItems = new List <NonIndexableItem>(); if (!reader.IsEmptyElement) { do { reader.Read(); NonIndexableItem nonIndexableItem = NonIndexableItem.LoadFromXml(reader); if (nonIndexableItem != null) { nonIndexableItems.Add(nonIndexableItem); } }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.Items)); nonIndexableItemDetailsResult.Items = nonIndexableItems.ToArray(); } } if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.FailedMailboxes)) { nonIndexableItemDetailsResult.FailedMailboxes = FailedSearchMailbox.LoadFailedMailboxesXml(XmlNamespace.Types, reader); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemDetailsResult)); return(nonIndexableItemDetailsResult); }
/// <summary> /// Load from xml /// </summary> /// <param name="reader">The reader</param> /// <returns>Mailbox hold object</returns> static MailboxHoldResult LoadFromXml(EwsServiceXmlReader reader) { List <MailboxHoldStatus> statuses = new List <MailboxHoldStatus>(); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.MailboxHoldResult); MailboxHoldResult holdResult = new MailboxHoldResult(); holdResult.HoldId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.HoldId); // the query could be empty means there won't be Query element, hence needs to read and check // if the next element is not Query, then it means already read MailboxHoldStatuses element reader.Read(); holdResult.Query = ""; if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Query)) { holdResult.Query = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Query); reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.MailboxHoldStatuses); } do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.MailboxHoldStatus)) { String mailbox = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Mailbox); HoldStatus status = (HoldStatus)Enum.Parse(typeof(HoldStatus), reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Status)); String additionalInfo = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.AdditionalInfo); statuses.Add(new MailboxHoldStatus(mailbox, status, additionalInfo)); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.MailboxHoldResult)); holdResult.Statuses = statuses.Count == 0 ? null : statuses.ToArray(); return(holdResult); }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { if (this.ErrorCode == ServiceError.NoError) { this.delegateUserResponses = new Collection<DelegateUserResponse>(); reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages)) { int delegateUserIndex = 0; do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.DelegateUserResponseMessageType)) { DelegateUser delegateUser = null; if (this.readDelegateUsers && (this.delegateUsers != null)) { delegateUser = this.delegateUsers[delegateUserIndex]; } DelegateUserResponse delegateUserResponse = new DelegateUserResponse(readDelegateUsers, delegateUser); delegateUserResponse.LoadFromXml(reader, XmlElementNames.DelegateUserResponseMessageType); this.delegateUserResponses.Add(delegateUserResponse); delegateUserIndex++; } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages)); } } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { this.Manifests.Clear(); base.ReadElementsFromXml(reader); reader.Read(XmlNodeType.Element); // We can have a response from Exchange 2013 (first time this API was introduced) // or the newer response, starting in Exchange 2013 SP1, (X-EWS-TargetVersion: 2.5 or above) bool exchange2013Response; if (XmlElementNames.Manifests.Equals(reader.LocalName)) { exchange2013Response = true; } else if (XmlElementNames.Apps.Equals(reader.LocalName)) { exchange2013Response = false; } else { throw new ServiceXmlDeserializationException( string.Format( Strings.UnexpectedElement, EwsUtilities.GetNamespacePrefix(XmlNamespace.Messages), XmlElementNames.Manifests, XmlNodeType.Element, reader.LocalName, reader.NodeType)); } if (!reader.IsEmptyElement) { // Because we don't have an element for count of returned object, // we have to test the element to determine if it is StartElement of return object or EndElement reader.Read(); if (exchange2013Response) { this.ReadFromExchange2013(reader); } else { this.ReadFromExchange2013Sp1(reader); } } reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, exchange2013Response ? XmlElementNames.Manifests : XmlElementNames.Apps); }
object ParseResponse(EwsServiceXmlReader reader) { GetUserAvailabilityResults serviceResponse = new GetUserAvailabilityResults(); if (this.IsFreeBusyViewRequested) { serviceResponse.AttendeesAvailability = new ServiceResponseCollection <AttendeeAvailability>(); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.FreeBusyResponseArray); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FreeBusyResponse)) { AttendeeAvailability freeBusyResponse = new AttendeeAvailability(); freeBusyResponse.LoadFromXml(reader, XmlElementNames.ResponseMessage); if (freeBusyResponse.ErrorCode == ServiceError.NoError) { freeBusyResponse.LoadFreeBusyViewFromXml(reader, this.Options.RequestedFreeBusyView); } serviceResponse.AttendeesAvailability.Add(freeBusyResponse); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.FreeBusyResponseArray)); } if (this.IsSuggestionsViewRequested) { serviceResponse.SuggestionsResponse = new SuggestionsResponse(); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.SuggestionsResponse); serviceResponse.SuggestionsResponse.LoadFromXml(reader, XmlElementNames.ResponseMessage); if (serviceResponse.SuggestionsResponse.ErrorCode == ServiceError.NoError) { serviceResponse.SuggestionsResponse.LoadSuggestedDaysFromXml(reader); } reader.ReadEndElement(XmlNamespace.Messages, XmlElementNames.SuggestionsResponse); } return(serviceResponse); }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.BaseFolderIds: this.RootFolderIds.InternalClear(); this.RootFolderIds.LoadFromXml(reader, reader.LocalName); return true; case XmlElementNames.Restriction: reader.Read(); this.searchFilter = SearchFilter.LoadFromXml(reader); return true; default: return false; } }
/// <summary> /// Load extended properties xml /// </summary> /// <param name="reader">The reader</param> /// <returns>Extended properties collection</returns> /* private */ static ExtendedPropertyCollection LoadExtendedPropertiesXml(EwsServiceXmlReader reader) { ExtendedPropertyCollection extendedProperties = new ExtendedPropertyCollection(); reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.ExtendedProperties); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ExtendedProperty)) { extendedProperties.LoadFromXml(reader, XmlElementNames.ExtendedProperty); } }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.ExtendedProperties)); return(extendedProperties.Count == 0 ? null : extendedProperties); }
/// <summary> /// Get collection of recipients /// </summary> /// <param name="reader">The reader</param> /// <param name="elementName">Element name</param> /// <returns>Array of recipients</returns> /* private */ static string[] GetRecipients(EwsServiceXmlReader reader, String elementName) { List <string> toRecipients = new List <string>(); do { if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SmtpAddress)) { toRecipients.Add(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SmtpAddress)); } reader.Read(); }while (!reader.IsEndElement(XmlNamespace.Types, elementName)); return(toRecipients.Count == 0 ? null : toRecipients.ToArray()); }
bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.Date: // The date that is returned by Availability is unscoped. DateTime tempDate = DateTime.Parse(reader.ReadElementValue <String>(), CultureInfo.InvariantCulture); if (tempDate.Kind != DateTimeKind.Unspecified) { this.date = new DateTime(tempDate.Ticks, DateTimeKind.Unspecified); } else { this.date = tempDate; } return(true); case XmlElementNames.DayQuality: this.quality = reader.ReadElementValue <SuggestionQuality>(); return(true); case XmlElementNames.SuggestionArray: if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Suggestion)) { TimeSuggestion timeSuggestion = new TimeSuggestion(); timeSuggestion.LoadFromXml(reader, reader.LocalName); this.timeSuggestions.Add(timeSuggestion); } }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.SuggestionArray)); } return(true); default: return(false); } }
bool TryReadElementFromXml(EwsServiceXmlReader reader) { while (true) { switch (reader.LocalName) { case XmlElementNames.Name: this.Name = reader.ReadElementValue <String>(); break; case XmlElementNames.EmailAddress: this.Address = reader.ReadElementValue <String>(); // Process the next node before returning. Otherwise, the current </EmailAddress> node // makes ComplexProperty.InternalLoadFromXml think that this ends the outer <EmailAddress> reader.Read(); if (reader.NodeType == System.Xml.XmlNodeType.Element) { continue; } break; case XmlElementNames.RoutingType: this.RoutingType = reader.ReadElementValue <String>(); break; case XmlElementNames.MailboxType: this.MailboxType = reader.ReadElementValue <MailboxType>(); break; case XmlElementNames.ItemId: this.Id = new ItemId(); this.Id.LoadFromXml(reader, reader.LocalName); break; case XmlElementNames.OriginalDisplayName: this.OriginalDisplayName = reader.ReadElementValue <String>(); break; default: return(false); } return(true); } }
/// <summary> /// Extracts a dictionary object (key or entry value) as a String list from the /// specified reader. /// </summary> /// <param name="reader">The reader.</param> /// <param name="type">The object type.</param> /// <returns>String list representing a dictionary object.</returns> /* private */ List <string> GetObjectValue(EwsServiceXmlReader reader, UserConfigurationDictionaryObjectType type) { EwsUtilities.Assert( reader != null, "UserConfigurationDictionary.LoadFromXml", "reader is null"); List <string> values = new List <string>(); reader.ReadStartElement(this.Namespace, XmlElementNames.Value); do { String value = null; if (reader.IsEmptyElement) { // Only String types can be represented with empty values. switch (type) { case UserConfigurationDictionaryObjectType.String: case UserConfigurationDictionaryObjectType.StringArray: value = ""; break; default: EwsUtilities.Assert( false, "UserConfigurationDictionary.GetObjectValue", "Empty element passed for type: " + type.ToString()); break; } } else { value = reader.ReadElementValue(); } values.Add(value); reader.Read(); // Position at next element or DictionaryKey/DictionaryValue end element }while (reader.IsStartElement(this.Namespace, XmlElementNames.Value)); return(values); }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if appropriate element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.Date: // The date that is returned by Availability is unscoped. DateTime tempDate = DateTime.Parse(reader.ReadElementValue(), CultureInfo.InvariantCulture); if (tempDate.Kind != DateTimeKind.Unspecified) { this.date = new DateTime(tempDate.Ticks, DateTimeKind.Unspecified); } else { this.date = tempDate; } return true; case XmlElementNames.DayQuality: this.quality = reader.ReadElementValue<SuggestionQuality>(); return true; case XmlElementNames.SuggestionArray: if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Suggestion)) { TimeSuggestion timeSuggestion = new TimeSuggestion(); timeSuggestion.LoadFromXml(reader, reader.LocalName); this.timeSuggestions.Add(timeSuggestion); } } while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.SuggestionArray)); } return true; default: return false; } }
/// <summary> /// Loads the suggested days from XML. /// </summary> /// <param name="reader">The reader.</param> void LoadSuggestedDaysFromXml(EwsServiceXmlReader reader) { reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.SuggestionDayResultArray); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SuggestionDayResult)) { Suggestion daySuggestion = new Suggestion(); daySuggestion.LoadFromXml(reader, reader.LocalName); this.daySuggestions.Add(daySuggestion); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.SuggestionDayResultArray)); }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.BaseFolderIds: this.RootFolderIds.InternalClear(); this.RootFolderIds.LoadFromXml(reader, reader.LocalName); return(true); case XmlElementNames.Restriction: reader.Read(); this.searchFilter = SearchFilter.LoadFromXml(reader); return(true); default: return(false); } }
/// <summary> /// Loads the suggested days from XML. /// </summary> /// <param name="reader">The reader.</param> internal void LoadSuggestedDaysFromXml(EwsServiceXmlReader reader) { reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.SuggestionDayResultArray); do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SuggestionDayResult)) { Suggestion daySuggestion = new Suggestion(); daySuggestion.LoadFromXml(reader, reader.LocalName); this.daySuggestions.Add(daySuggestion); } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.SuggestionDayResultArray)); }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.RootFolder); this.results.TotalCount = reader.ReadAttributeValue<int>(XmlAttributeNames.TotalItemsInView); this.results.MoreAvailable = !reader.ReadAttributeValue<bool>(XmlAttributeNames.IncludesLastItemInRange); // Ignore IndexedPagingOffset attribute if MoreAvailable is false. this.results.NextPageOffset = results.MoreAvailable ? reader.ReadNullableAttributeValue<int>(XmlAttributeNames.IndexedPagingOffset) : null; reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Folders); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.NodeType == XmlNodeType.Element) { Folder folder = EwsUtilities.CreateEwsObjectFromXmlElementName<Folder>(reader.Service, reader.LocalName); if (folder == null) { reader.SkipCurrentElement(); } else { folder.LoadFromXml( reader, true, /* clearPropertyBag */ this.propertySet, true /* summaryPropertiesOnly */); this.results.Folders.Add(folder); } } } while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.Folders)); } reader.ReadEndElement(XmlNamespace.Messages, XmlElementNames.RootFolder); }
void ReadElementsFromXml(EwsServiceXmlReader reader) { this.configurations.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.DiscoverySearchConfigurations); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.DiscoverySearchConfiguration)) { this.configurations.Add(DiscoverySearchConfiguration.LoadFromXml(reader)); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.DiscoverySearchConfigurations)); } reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.DiscoverySearchConfigurations); }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { base.ReadElementsFromXml(reader); reader.Read(); if (reader.LocalName == XmlElementNames.Notifications) { this.results.LoadFromXml(reader); } else if (reader.LocalName == XmlElementNames.ConnectionStatus) { string connectionStatus = reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.ConnectionStatus); if (connectionStatus.Equals(ConnectionStatus.Closed.ToString())) { this.request.Disconnect(HangingRequestDisconnectReason.Clean, null); } } }
void ReadElementsFromXml(EwsServiceXmlReader reader) { this.retentionPolicyTags.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.RetentionPolicyTags); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.RetentionPolicyTag)) { this.retentionPolicyTags.Add(RetentionPolicyTag.LoadFromXml(reader)); } }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.RetentionPolicyTags)); reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.RetentionPolicyTags); } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { this.configurations.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.DiscoverySearchConfigurations); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.DiscoverySearchConfiguration)) { this.configurations.Add(DiscoverySearchConfiguration.LoadFromXml(reader)); } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.DiscoverySearchConfigurations)); } reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.DiscoverySearchConfigurations); }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { this.retentionPolicyTags.Clear(); base.ReadElementsFromXml(reader); reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.RetentionPolicyTags); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.RetentionPolicyTag)) { this.retentionPolicyTags.Add(RetentionPolicyTag.LoadFromXml(reader)); } } while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.RetentionPolicyTags)); reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.RetentionPolicyTags); } }
/// <summary> /// Reads response elements from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadElementsFromXml(EwsServiceXmlReader reader) { base.ReadElementsFromXml(reader); if (this.ErrorCode == ServiceError.NoError) { // If there were no response messages, the reader will already be on the // DeliverMeetingRequests start element, so we don't need to read it. if (this.DelegateUserResponses.Count > 0) { reader.Read(); } // Make sure that we're at the DeliverMeetingRequests element before trying to read the value. // In error cases, the element may not have been returned. if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.DeliverMeetingRequests)) { this.meetingRequestsDeliveryScope = reader.ReadElementValue<MeetingRequestsDeliveryScope>(); } } }
/// <summary> /// Loads from XML. /// </summary> /// <param name="reader">The reader.</param> /// <param name="propertyBag">The property bag.</param> internal override sealed void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) { ResponseActions value = ResponseActions.None; reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, this.XmlElementName); if (!reader.IsEmptyElement) { do { reader.Read(); if (reader.IsStartElement()) { value |= GetResponseAction(reader.LocalName); } } while (!reader.IsEndElement(XmlNamespace.Types, this.XmlElementName)); } propertyBag[this] = value; }