WriteElementsToXml method

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

Implementation

@override
void WriteElementsToXml(EwsServiceXmlWriter writer) {
  writer.WriteStartElement(
      XmlNamespace.Autodiscover, XmlElementNames.Request);

  writer.WriteStartElement(
      XmlNamespace.Autodiscover, XmlElementNames.Domains);

  for (String domain in this.Domains!) {
    if (!StringUtils.IsNullOrEmpty(domain)) {
      writer.WriteElementValueWithNamespace(
          XmlNamespace.Autodiscover, XmlElementNames.Domain, domain);
    }
  }
  writer.WriteEndElement(); // Domains

  writer.WriteStartElement(
      XmlNamespace.Autodiscover, XmlElementNames.RequestedSettings);
  for (DomainSettingName setting in _settings!) {
    writer.WriteElementValueWithNamespace(
        XmlNamespace.Autodiscover, XmlElementNames.Setting, setting);
  }

  writer.WriteEndElement(); // RequestedSettings

  if (this._requestedVersion != null) {
    writer.WriteElementValueWithNamespace(XmlNamespace.Autodiscover,
        XmlElementNames.RequestedVersion, this._requestedVersion);
  }

  writer.WriteEndElement(); // Request
}