WritePropertyValueToXml method

  1. @override
void WritePropertyValueToXml(
  1. EwsServiceXmlWriter writer,
  2. PropertyBag propertyBag,
  3. bool isUpdateOperation
)
override
Writes to XML. The writer. The property bag. Indicates whether the context is an update operation.

Implementation

@override
void WritePropertyValueToXml(EwsServiceXmlWriter writer,
    PropertyBag propertyBag, bool isUpdateOperation) {
  TimeZone? value = propertyBag[this] as TimeZone?;

  if (value != null) {
    // We emit time zone properties only if we have not emitted the time zone SOAP header
    // or if this time zone is different from that of the service through which the request
    // is being emitted.
    if (!writer.IsTimeZoneHeaderEmitted || value != writer.Service.TimeZone) {
      TimeZoneDefinition timeZoneDefinition =
          new TimeZoneDefinition.withTimeZone(value);

      timeZoneDefinition.WriteToXml(writer, this.XmlElementName);
    }
  }
}