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.Users);

  for (String smtpAddress in this.SmtpAddresses!) {
    writer.WriteStartElement(XmlNamespace.Autodiscover, XmlElementNames.User);

    if (!StringUtils.IsNullOrEmpty(smtpAddress)) {
      writer.WriteElementValueWithNamespace(
          XmlNamespace.Autodiscover, XmlElementNames.Mailbox, smtpAddress);
    }
    writer.WriteEndElement(); // User
  }
  writer.WriteEndElement(); // Users

  writer.WriteStartElement(
      XmlNamespace.Autodiscover, XmlElementNames.RequestedSettings);
  for (UserSettingName setting in this.Settings!) {
    writer.WriteElementValueWithNamespace(
        XmlNamespace.Autodiscover, XmlElementNames.Setting, setting);
  }

  writer.WriteEndElement(); // RequestedSettings

  writer.WriteEndElement(); // Request
}