TryReadElementFromXml method

  1. @override
Future<bool> TryReadElementFromXml(
  1. EwsServiceXmlReader reader
)
override
Defines an implicit conversion between a String representing an SMTP address and EmailAddress. The SMTP address to convert to EmailAddress. Tries to read element from XML. The reader.

Implementation

// static implicit operator EmailAddress(String smtpAddress)
//        {
//            return new EmailAddress(smtpAddress);
//        }

/// <summary>
/// Tries to read element from XML.
/// </summary>
/// <param name="reader">The reader.</param>
/// <returns>True if element was read.</returns>
@override
Future<bool> TryReadElementFromXml(EwsServiceXmlReader reader) async {
  switch (reader.LocalName) {
    case XmlElementNames.Name:
      this.name = await reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.EmailAddress:
      this.address = await reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.RoutingType:
      this.routingType = await reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.MailboxType:
      this.mailboxType =
          await reader.ReadElementValue<enumerations.MailboxType>();
      return true;
    case XmlElementNames.ItemId:
      this.id = new ItemId();
      await this.id!.LoadFromXml(reader, reader.LocalName);
      return true;
    default:
      return false;
  }
}