WriteToXml method
Writes to XML.
The writer.
Implementation
void WriteToXml(EwsServiceXmlWriter writer) {
if (StringUtils.IsNullOrEmpty(_id)) {
throw ArgumentException("The Id property must be set.");
}
writer.WriteStartElement(
XmlNamespace.Types,
XmlElementNames.ExchangeImpersonation,
);
writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ConnectingSID);
// For 2007 SP1, use PrimarySmtpAddress for type SmtpAddress
String connectingIdTypeLocalName =
(_idType == ConnectingIdType.SmtpAddress) &&
(writer.Service.RequestedServerVersion ==
ExchangeVersion.Exchange2007_SP1)
? XmlElementNames.PrimarySmtpAddress
: EnumToString.parse(IdType)!;
writer.WriteElementValueWithNamespace(
XmlNamespace.Types,
connectingIdTypeLocalName,
_id,
);
writer.WriteEndElement(); // ConnectingSID
writer.WriteEndElement(); // ExchangeImpersonation
}