/// <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> /// Loads AlternateMailbox instance from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>AlternateMailbox.</returns> internal static AlternateMailbox LoadFromXml(EwsXmlReader reader) { AlternateMailbox altMailbox = new AlternateMailbox(); do { reader.Read(); if (reader.NodeType == XmlNodeType.Element) { switch (reader.LocalName) { case XmlElementNames.Type: altMailbox.Type = reader.ReadElementValue <string>(); break; case XmlElementNames.DisplayName: altMailbox.DisplayName = reader.ReadElementValue <string>(); break; case XmlElementNames.LegacyDN: altMailbox.LegacyDN = reader.ReadElementValue <string>(); break; case XmlElementNames.Server: altMailbox.Server = reader.ReadElementValue <string>(); break; case XmlElementNames.SmtpAddress: altMailbox.SmtpAddress = reader.ReadElementValue <string>(); break; case XmlElementNames.OwnerSmtpAddress: altMailbox.OwnerSmtpAddress = reader.ReadElementValue <string>(); break; default: break; } } }while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.AlternateMailbox)); return(altMailbox); }
/// <summary> /// Loads AlternateMailbox instance from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>AlternateMailbox.</returns> internal static AlternateMailbox LoadFromXml(EwsXmlReader reader) { AlternateMailbox altMailbox = new AlternateMailbox(); do { reader.Read(); if (reader.NodeType == XmlNodeType.Element) { switch (reader.LocalName) { case XmlElementNames.Type: altMailbox.Type = reader.ReadElementValue<string>(); break; case XmlElementNames.DisplayName: altMailbox.DisplayName = reader.ReadElementValue<string>(); break; case XmlElementNames.LegacyDN: altMailbox.LegacyDN = reader.ReadElementValue<string>(); break; case XmlElementNames.Server: altMailbox.Server = reader.ReadElementValue<string>(); break; case XmlElementNames.SmtpAddress: altMailbox.SmtpAddress = reader.ReadElementValue<string>(); break; case XmlElementNames.OwnerSmtpAddress: altMailbox.OwnerSmtpAddress = reader.ReadElementValue<string>(); break; default: break; } } } while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.AlternateMailbox)); return altMailbox; }
/// <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)); }