ReadElementsFromXml method
Reads response elements from XML.
The reader.
Implementation
@override
Future<void> ReadElementsFromXml(EwsServiceXmlReader reader) async {
await reader.ReadStartElementWithNamespace(
XmlNamespace.Messages, XmlElementNames.RootFolder);
this._results.TotalCount =
reader.ReadAttributeValue<int>(XmlAttributeNames.TotalItemsInView);
this._results.MoreAvailable = !reader.ReadAttributeValue<bool>(
XmlAttributeNames.IncludesLastItemInRange)!;
// Ignore IndexedPagingOffset attribute if MoreAvailable is false.
this._results.NextPageOffset = _results.MoreAvailable
? reader.ReadNullableAttributeValue<int>(
XmlAttributeNames.IndexedPagingOffset)
: null;
await reader.ReadStartElementWithNamespace(
XmlNamespace.Types, XmlElementNames.Folders);
if (!reader.IsEmptyElement) {
do {
await reader.Read();
if (reader.NodeType == XmlNodeType.Element) {
Folder folder =
EwsUtilities.CreateEwsObjectFromXmlElementName<Folder>(
reader.Service, reader.LocalName);
if (folder == null) {
await reader.SkipCurrentElement();
} else {
await folder.LoadFromXmlWithPropertySet(
reader,
true,
/* clearPropertyBag */
this._propertySet,
true /* summaryPropertiesOnly */);
this._results.Folders.add(folder);
}
}
} while (!reader.IsEndElementWithNamespace(
XmlNamespace.Types, XmlElementNames.Folders));
}
await reader.ReadEndElementWithNamespace(
XmlNamespace.Messages, XmlElementNames.RootFolder);
}