/** * Writes to XML. * * @param writer The writer * @throws Exception the exception */ public void writeToXml(EwsServiceXmlWriter writer) throws Exception { if (this.id == null || this.id.isEmpty()) { throw new Exception("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 = (this.idType == ConnectingIdType.SmtpAddress) && (writer.getService().getRequestedServerVersion() == ExchangeVersion.Exchange2007_SP1) ? XmlElementNames.PrimarySmtpAddress : this.getIdType().toString(); writer.writeElementValue(XmlNamespace.Types, connectingIdTypeLocalName, this.id); writer.writeEndElement(); // ConnectingSID writer.writeEndElement(); // ExchangeImpersonation }
/** * Writes to XML. * * @param writer The writer * @throws Exception the exception */ public void writeToXml(EwsServiceXmlWriter writer) throws Exception { if (this.id == null || this.id.isEmpty()) { throw new Exception("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 = (this.idType == ConnectingIdType.SmtpAddress) && (writer.getService().getRequestedServerVersion() == ExchangeVersion.Exchange2007_SP1) ? XmlElementNames.PrimarySmtpAddress : this.getIdType().toString(); writer.writeElementValue(XmlNamespace.Types, connectingIdTypeLocalName, this.id); writer.writeEndElement(); // ConnectingSID writer.writeEndElement(); // ExchangeImpersonation }