WriteElementsToXml method

  1. @override
void WriteElementsToXml(
  1. EwsServiceXmlWriter writer
)
override
Writes elements to XML. The writer.

Implementation

@override
void WriteElementsToXml(EwsServiceXmlWriter writer) {
  // We only emit the full time zone definition against Exchange 2010 servers and above.
  if (writer.Service.RequestedServerVersion !=
      ExchangeVersion.Exchange2007_SP1) {
    if (this._periods.length > 0) {
      writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Periods);

      for (MapEntry<String?, TimeZonePeriod> keyValuePair
          in this._periods.entries) {
        keyValuePair.value.WriteToXmlElementName(writer);
      }

      writer.WriteEndElement(); // Periods
    }

    if (this._transitionGroups.length > 0) {
      writer.WriteStartElement(
          XmlNamespace.Types, XmlElementNames.TransitionsGroups);

      for (MapEntry<String?, TimeZoneTransitionGroup> keyValuePair
          in this._transitionGroups.entries) {
        keyValuePair.value.WriteToXmlElementName(writer);
      }

      writer.WriteEndElement(); // TransitionGroups
    }

    if (this._transitions.length > 0) {
      writer.WriteStartElement(
          XmlNamespace.Types, XmlElementNames.Transitions);

      for (TimeZoneTransition transition in this._transitions) {
        transition.WriteToXmlElementName(writer);
      }

      writer.WriteEndElement(); // Transitions
    }
  }
}