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.ReadServiceObjectsCollectionFromXml<Item>(
      XmlElementNames.Items,
      this._GetObjectInstance,
      false,
      /* clearPropertyBag */
      null,
      /* requestedPropertySet */
      false); /* summaryPropertiesOnly */

  // ConflictResults was only added in 2007 SP1 so if this was a 2007 RTM request we shouldn't expect to find the element
  if (!reader.Service.Exchange2007CompatibilityMode) {
    await reader.ReadStartElementWithNamespace(
        XmlNamespace.Messages, XmlElementNames.ConflictResults);
    this._conflictCount = await reader.ReadElementValueWithNamespace<int>(
        XmlNamespace.Types, XmlElementNames.Count);
    await reader.ReadEndElementWithNamespace(
        XmlNamespace.Messages, XmlElementNames.ConflictResults);
  }

  // If UpdateItem returned an item that has the same Id as the item that
  // is being updated, this is a "normal" UpdateItem operation, and we need
  // to update the ChangeKey of the item being updated with the one that was
  // returned. Also set returnedItem to indicate that no new item was returned.
  //
  // Otherwise, this in a "special" UpdateItem operation, such as a recurring
  // task marked as complete (the returned item in that case is the one-off
  // task that represents the completed instance).
  //
  // Note that there can be no returned item at all, as in an UpdateItem call
  // with MessageDisposition set to SendOnly or SendAndSaveCopy.
  if (this._returnedItem != null) {
    if (this._item.Id!.UniqueId == this._returnedItem!.Id!.UniqueId) {
      this._item.Id!.ChangeKey = this._returnedItem!.Id!.ChangeKey;
      this._returnedItem = null;
    }
  }
}