/// <summary> /// Loads instance of AlternateMailboxCollection from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>AlternateMailboxCollection</returns> internal static AlternateMailboxCollection LoadFromXml(EwsXmlReader reader) { AlternateMailboxCollection instance = new AlternateMailboxCollection(); do { reader.Read(); if ((reader.NodeType == XmlNodeType.Element) && (reader.LocalName == XmlElementNames.AlternateMailbox)) { instance.Entries.Add(AlternateMailbox.LoadFromXml(reader)); } }while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.AlternateMailboxes)); return(instance); }
/// <summary> /// Load from XML. /// </summary> /// <param name="reader">The reader.</param> internal void LoadFromXml(EwsXmlReader reader) { do { reader.Read(); if (reader.NodeType == XmlNodeType.Element) { switch (reader.LocalName) { case XmlElementNames.AccountType: this.AccountType = reader.ReadElementValue(); break; case XmlElementNames.Action: string xmlResponseType = reader.ReadElementValue(); switch (xmlResponseType) { case OutlookAccount.Settings: this.ResponseType = AutodiscoverResponseType.Success; break; case OutlookAccount.RedirectUrl: this.ResponseType = AutodiscoverResponseType.RedirectUrl; break; case OutlookAccount.RedirectAddr: this.ResponseType = AutodiscoverResponseType.RedirectAddress; break; default: this.ResponseType = AutodiscoverResponseType.Error; break; } break; case XmlElementNames.Protocol: OutlookProtocol protocol = new OutlookProtocol(); protocol.LoadFromXml(reader); if (this.protocols.ContainsKey(protocol.ProtocolType)) { // There should be strictly one node per protocol type in the autodiscover response. throw new ServiceLocalException(Strings.InvalidAutodiscoverServiceResponse); } this.protocols.Add(protocol.ProtocolType, protocol); break; case XmlElementNames.RedirectAddr: case XmlElementNames.RedirectUrl: this.RedirectTarget = reader.ReadElementValue(); break; case XmlElementNames.AlternateMailboxes: AlternateMailbox alternateMailbox = AlternateMailbox.LoadFromXml(reader); this.alternateMailboxes.Entries.Add(alternateMailbox); break; default: reader.SkipCurrentElement(); break; } } }while (!reader.IsEndElement(XmlNamespace.NotSpecified, XmlElementNames.Account)); }