TryReadElementFromXmlToPatch method

  1. @override
Future<bool> TryReadElementFromXmlToPatch(
  1. EwsServiceXmlReader reader
)
override
For ItemAttachment, AttachmentId and Item should be patched.

Implementation

@override
Future<bool> TryReadElementFromXmlToPatch(EwsServiceXmlReader reader) async {
  // update the attachment id.
  await super.TryReadElementFromXml(reader);

  await reader.Read();
  Type? itemClass =
      EwsUtilities.GetItemTypeFromXmlElementName(reader.LocalName);

  if (itemClass != null) {
    if (this._item == null || this._item.runtimeType != itemClass) {
      throw new ServiceLocalException("Strings.AttachmentItemTypeMismatch");
    }

    await this._item!.LoadFromXml(reader, false /* clearPropertyBag */);
    return true;
  }

  return false;
}