WriteDeleteUpdateToXml method

void WriteDeleteUpdateToXml(
  1. EwsServiceXmlWriter writer,
  2. PropertyDefinition propertyDefinition,
  3. Object? propertyValue
)
Writes an EWS DeleteUpdate opeartion for the specified property. The writer to write the update to. The property fro which to write the update. The current value of the property.

Implementation

/* private */
void WriteDeleteUpdateToXml(EwsServiceXmlWriter writer,
    PropertyDefinition propertyDefinition, Object? propertyValue) {
  // The following test should not be necessary since the property bag prevents
  // properties to be deleted (set to null) if they don't have the CanDelete flag,
  // but it doesn't hurt...
  if (propertyDefinition.HasFlagWithoutExchangeVersion(
      PropertyDefinitionFlags.CanDelete)) {
    bool handled = false;

    if (propertyValue is ICustomUpdateSerializer) {
      handled = propertyValue.WriteDeleteUpdateToXml(writer, this.Owner);
    }

    if (!handled) {
      writer.WriteStartElement(
          XmlNamespace.Types, this.Owner!.GetDeleteFieldXmlElementName());
      propertyDefinition.WriteToXml(writer);
      writer.WriteEndElement();
    }
  }
}