ReadElementsFromXml method

  1. @override
Future<void> ReadElementsFromXml(
  1. EwsServiceXmlReader reader
)
override
Reads response elements from XML. The reader.

Implementation

@override
Future<void> ReadElementsFromXml(EwsServiceXmlReader reader) async {
  await super.ReadElementsFromXml(reader);

  await reader.ReadStartElementWithNamespace(
      XmlNamespace.Messages, XmlElementNames.Attachments);
  if (!reader.IsEmptyElement) {
    await reader.Read(nodeType: XmlNodeType.Element);

    if (this.attachment == null) {
      if (StringUtils.EqualsIgnoreCase(
          reader.LocalName, XmlElementNames.FileAttachment)) {
        this.attachment =
            new FileAttachment.withExchangeService(reader.Service);
      } else if (StringUtils.EqualsIgnoreCase(
          reader.LocalName, XmlElementNames.ItemAttachment)) {
        this.attachment =
            new ItemAttachment.withExchangeService(reader.Service);
      }
    }

    if (this.attachment != null) {
      await this.attachment!.LoadFromXml(reader, reader.LocalName);
    }

    await reader.ReadEndElementWithNamespace(
        XmlNamespace.Messages, XmlElementNames.Attachments);
  }
}