WriteElementsToXml method

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

Implementation

@override
void WriteElementsToXml(EwsServiceXmlWriter writer) {
  if (this.BodyType != null || this.AdditionalProperties.length > 0) {
    writer.WriteStartElement(
        XmlNamespace.Messages, XmlElementNames.AttachmentShape);

    if (this.BodyType != null) {
      writer.WriteElementValueWithNamespace(
          XmlNamespace.Types, XmlElementNames.BodyType, this.BodyType);
    }

    if (this.AdditionalProperties.length > 0) {
      PropertySet.WriteAdditionalPropertiesToXml(
          writer, this.AdditionalProperties);
    }

    writer.WriteEndElement(); // AttachmentShape
  }

  writer.WriteStartElement(
      XmlNamespace.Messages, XmlElementNames.AttachmentIds);

  for (Attachment attachment in this.Attachments) {
    this._WriteAttachmentIdXml(writer, attachment.Id);
  }

  for (String attachmentId in this.AttachmentIds) {
    this._WriteAttachmentIdXml(writer, attachmentId);
  }

  writer.WriteEndElement();
}