TryReadElementFromXml method

  1. @override
bool TryReadElementFromXml(
  1. EwsServiceXmlReader reader
)
override
Tries to read element from XML. The reader.

Implementation

@override
bool TryReadElementFromXml(EwsServiceXmlReader reader) {
  switch (reader.LocalName) {
    case XmlElementNames.AttachmentId:
      this._id = reader.ReadAttributeValue(XmlAttributeNames.Id);

      if (this.Owner != null) {
        String? rootItemChangeKey =
            reader.ReadAttributeValue(XmlAttributeNames.RootItemChangeKey);

        if (!StringUtils.IsNullOrEmpty(rootItemChangeKey)) {
          this.Owner!.RootItemId!.ChangeKey = rootItemChangeKey;
        }
      }
      reader.ReadEndElementIfNecessary(
          XmlNamespace.Types, XmlElementNames.AttachmentId);
      return true;
    case XmlElementNames.Name:
      this._name = reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.ContentType:
      this._contentType = reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.ContentId:
      this._contentId = reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.ContentLocation:
      this._contentLocation = reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.Size:
      this._size = reader.ReadElementValue<int>();
      return true;
    case XmlElementNames.LastModifiedTime:
      this._lastModifiedTime = reader.ReadElementValueAsDateTime();
      return true;
    case XmlElementNames.IsInline:
      this._isInline = reader.ReadElementValue<bool>();
      return true;
    default:
      return false;
  }
}