WriteElementsToXml method

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

Implementation

@override
void WriteElementsToXml(EwsServiceXmlWriter writer) {
  super.WriteElementsToXml(writer);

  if (writer.Service.RequestedServerVersion.index >
      ExchangeVersion.Exchange2007_SP1.index) {
    writer.WriteElementValueWithNamespace(XmlNamespace.Types,
        XmlElementNames.IsContactPhoto, this._isContactPhoto);
  }

  writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Content);

  if (!StringUtils.IsNullOrEmpty(this.FileName)) {
    throw UnsupportedError("Can't send attachment with a file");
//                {
//                    writer.WriteBase64ElementValue(fileStream);
//                }
  } else if (this.ContentStream != null) {
    throw UnsupportedError("Can't send attachment with a stream");
//                writer.WriteBase64ElementValue(this.ContentStream);
  } else if (this.Content != null) {
    writer.WriteBase64ElementValue(this.Content!);
  } else {
    EwsUtilities.Assert(false, "FileAttachment.WriteElementsToXml",
        "The attachment's content is not set.");
  }

  writer.WriteEndElement();
}