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.ExtendedFieldURI:
      this._propertyDefinition = new ExtendedPropertyDefinition();
      this._propertyDefinition!.LoadFromXml(reader);
      return true;
    case XmlElementNames.Value:
      EwsUtilities.Assert(
          this.PropertyDefinition != null,
          "ExtendedProperty.TryReadElementFromXml",
          "PropertyDefintion is missing");

      String? stringValue = reader.ReadElementValue<String>();
      this._value = MapiTypeConverter.ConvertToValueWithStringValue(
          this.PropertyDefinition!.MapiType, stringValue);
      return true;
    case XmlElementNames.Values:
      EwsUtilities.Assert(
          this.PropertyDefinition != null,
          "ExtendedProperty.TryReadElementFromXml",
          "PropertyDefintion is missing");

      StringList stringList =
          new StringList.fromElementName(XmlElementNames.Value);
      stringList.LoadFromXml(reader, reader.LocalName);
      this._value = MapiTypeConverter.ConvertToValue(
          this.PropertyDefinition!.MapiType, stringList);
      return true;
    default:
      return false;
  }
}