LoadFromXml static method

Future<AlternateMailbox> LoadFromXml(
  1. EwsXmlReader reader
)
Loads AlternateMailbox instance from XML. The reader.

Implementation

static Future<AlternateMailbox> LoadFromXml(EwsXmlReader reader) async {
  AlternateMailbox altMailbox = new AlternateMailbox._();

  do {
    await reader.Read();

    if (reader.NodeType == XmlNodeType.Element) {
      switch (reader.LocalName) {
        case XmlElementNames.Type:
          altMailbox.Type = await reader.ReadElementValue<String>();
          break;
        case XmlElementNames.DisplayName:
          altMailbox.DisplayName = await reader.ReadElementValue<String>();
          break;
        case XmlElementNames.LegacyDN:
          altMailbox.LegacyDN = await reader.ReadElementValue<String>();
          break;
        case XmlElementNames.Server:
          altMailbox.Server = await reader.ReadElementValue<String>();
          break;
        case XmlElementNames.SmtpAddress:
          altMailbox.SmtpAddress = await reader.ReadElementValue<String>();
          break;
        case XmlElementNames.OwnerSmtpAddress:
          altMailbox.OwnerSmtpAddress =
              await reader.ReadElementValue<String>();
          break;
        default:
          break;
      }
    }
  } while (!reader.IsEndElementWithNamespace(
      XmlNamespace.Autodiscover, XmlElementNames.AlternateMailbox));

  return altMailbox;
}