WriteElementsToXml method
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,
_isContactPhoto,
);
}
writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Content);
if (!StringUtils.IsNullOrEmpty(FileName)) {
throw UnsupportedError("Can't send attachment with a file");
// {
// writer.WriteBase64ElementValue(fileStream);
// }
} else if (ContentStream != null) {
throw UnsupportedError("Can't send attachment with a stream");
// writer.WriteBase64ElementValue(this.ContentStream);
} else if (Content != null) {
writer.WriteBase64ElementValue(Content!);
} else {
EwsUtilities.Assert(
false,
"FileAttachment.WriteElementsToXml",
"The attachment's content is not set.",
);
}
writer.WriteEndElement();
}