WriteSetUpdateToXml method

bool WriteSetUpdateToXml(
  1. EwsServiceXmlWriter writer,
  2. ServiceObject? ewsObject,
  3. PropertyDefinition propertyDefinition
)
override
Writes the update to XML. The writer. The ews object. Property definition.

Implementation

bool WriteSetUpdateToXml(EwsServiceXmlWriter writer, ServiceObject? ewsObject,
    PropertyDefinition propertyDefinition) {
  List<ExtendedProperty> propertiesToSet = <ExtendedProperty>[];

  propertiesToSet.addAll(this.AddedItems);
  propertiesToSet.addAll(this.ModifiedItems);

  for (ExtendedProperty extendedProperty in propertiesToSet) {
    writer.WriteStartElement(
        XmlNamespace.Types, ewsObject!.GetSetFieldXmlElementName());
    extendedProperty.PropertyDefinition!.WriteToXml(writer);

    writer.WriteStartElement(
        XmlNamespace.Types, ewsObject.GetXmlElementName());
    extendedProperty.WriteToXml(writer, XmlElementNames.ExtendedProperty);
    writer.WriteEndElement();

    writer.WriteEndElement();
  }

  for (ExtendedProperty? extendedProperty in this.RemovedItems) {
    writer.WriteStartElement(
        XmlNamespace.Types, ewsObject!.GetDeleteFieldXmlElementName());
    extendedProperty!.PropertyDefinition!.WriteToXml(writer);
    writer.WriteEndElement();
  }

  return true;
}