/// <summary> /// Writes to XML. /// </summary> /// <param name="writer">The writer.</param> /// <param name="requestedServerVersion">The requested server version.</param> void WriteToXml(EwsServiceXmlWriter writer, ExchangeVersion requestedServerVersion) { if (StringUtils.IsNullOrEmpty(this.id)) { throw new ArgumentError(Strings.IdPropertyMustBeSet); } writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.OpenAsAdminOrSystemService); writer.WriteAttributeString(XmlElementNames.LogonType, this.logonType.ToString()); if (requestedServerVersion >= ExchangeVersion.Exchange2013 && this.budgetType.HasValue) { writer.WriteAttributeString(XmlElementNames.BudgetType, ((int)this.budgetType.Value).ToString()); } writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ConnectingSID); writer.WriteElementValue(XmlNamespace.Types, this.idType.ToString(), this.id); writer.WriteEndElement(); // ConnectingSID writer.WriteEndElement(); // OpenAsAdminOrSystemService }
void WriteElementsToXml(EwsServiceXmlWriter writer) { // Emit the view element // this.View.WriteToXml(writer, null); // Emit the Sort Order // this.View.WriteOrderByToXml(writer); // Emit the Parent Folder Id // writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ParentFolderId); this.FolderId.WriteToXml(writer); writer.WriteEndElement(); // Emit the MailboxScope flag // if (this.MailboxScope.HasValue) { writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MailboxScope, this.MailboxScope.Value); } if (!StringUtils.IsNullOrEmpty(this.queryString)) { // Emit the QueryString // writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.QueryString); if (this.ReturnHighlightTerms) { writer.WriteAttributeString(XmlAttributeNames.ReturnHighlightTerms, this.ReturnHighlightTerms.ToString().ToLowerInvariant()); } writer.WriteValue(this.queryString, XmlElementNames.QueryString); writer.WriteEndElement(); } if (this.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013) { if (this.View.PropertySet != null) { this.View.PropertySet.WriteToXml(writer, ServiceObjectType.Conversation); } } }