LoadFromXml method

  1. @override
Future<void> LoadFromXml(
  1. EwsServiceXmlReader reader,
  2. String? localElementName
)
override
Loads from XML. The reader. Name of the local element.

Implementation

@override
Future<void> LoadFromXml(
    EwsServiceXmlReader reader, String? localElementName) async {
  reader.EnsureCurrentNodeIsStartElementWithNamespace(
      XmlNamespace.Types, localElementName);
  if (!reader.IsEmptyElement) {
    do {
      await reader.Read();

      if (reader.NodeType == XmlNodeType.Element) {
        TItem item = EwsUtilities.CreateEwsObjectFromXmlElementName<Item>(
            reader.Service, reader.LocalName) as TItem;

        if (item == null) {
          await reader.SkipCurrentElement();
        } else {
          await item.LoadFromXml(reader, true /* clearPropertyBag */);

          this.items.add(item);
        }
      }
    } while (!reader.IsEndElementWithNamespace(
        XmlNamespace.Types, localElementName));
  }
}