WriteToXml method

void WriteToXml(
  1. EwsServiceXmlWriter writer,
  2. ServiceObjectType? serviceObjectType
)
Writes the property set to XML. The writer to write to. The type of service object the property set is emitted for.

Implementation

void WriteToXml(
    EwsServiceXmlWriter writer, ServiceObjectType? serviceObjectType) {
  String shapeElementName = _GetShapeName(serviceObjectType);

  writer.WriteStartElement(XmlNamespace.Messages, shapeElementName);

  writer.WriteElementValueWithNamespace(
      XmlNamespace.Types,
      XmlElementNames.BaseShape,
      _defaultPropertySetMap.Member![this.BasePropertySet!]);

  if (serviceObjectType == ServiceObjectType.Item) {
    if (this.RequestedBodyType != null) {
      writer.WriteElementValueWithNamespace(XmlNamespace.Types,
          XmlElementNames.BodyType, this.RequestedBodyType);
    }

    if (this.RequestedUniqueBodyType != null) {
      writer.WriteElementValueWithNamespace(XmlNamespace.Types,
          XmlElementNames.UniqueBodyType, this.RequestedUniqueBodyType);
    }

    if (this.RequestedNormalizedBodyType != null) {
      writer.WriteElementValueWithNamespace(
          XmlNamespace.Types,
          XmlElementNames.NormalizedBodyType,
          this.RequestedNormalizedBodyType);
    }

    if (this.FilterHtmlContent != null) {
      writer.WriteElementValueWithNamespace(XmlNamespace.Types,
          XmlElementNames.FilterHtmlContent, this.FilterHtmlContent);
    }

    if (this.ConvertHtmlCodePageToUTF8 != null &&
        writer.Service.RequestedServerVersion.index >=
            ExchangeVersion.Exchange2010_SP1.index) {
      writer.WriteElementValueWithNamespace(
          XmlNamespace.Types,
          XmlElementNames.ConvertHtmlCodePageToUTF8,
          this.ConvertHtmlCodePageToUTF8);
    }

    if (!StringUtils.IsNullOrEmpty(this.InlineImageUrlTemplate) &&
        writer.Service.RequestedServerVersion.index >=
            ExchangeVersion.Exchange2013.index) {
      writer.WriteElementValueWithNamespace(
          XmlNamespace.Types,
          XmlElementNames.InlineImageUrlTemplate,
          this.InlineImageUrlTemplate);
    }

    if (this.BlockExternalImages != null &&
        writer.Service.RequestedServerVersion.index >=
            ExchangeVersion.Exchange2013.index) {
      writer.WriteElementValueWithNamespace(XmlNamespace.Types,
          XmlElementNames.BlockExternalImages, this.BlockExternalImages);
    }

    if (this.AddBlankTargetToLinks != null &&
        writer.Service.RequestedServerVersion.index >=
            ExchangeVersion.Exchange2013.index) {
      writer.WriteElementValueWithNamespace(XmlNamespace.Types,
          XmlElementNames.AddBlankTargetToLinks, this.AddBlankTargetToLinks);
    }

    if (this.MaximumBodySize != null &&
        writer.Service.RequestedServerVersion.index >=
            ExchangeVersion.Exchange2013.index) {
      writer.WriteElementValueWithNamespace(XmlNamespace.Types,
          XmlElementNames.MaximumBodySize, this.MaximumBodySize);
    }
  }

  if (this._additionalProperties.length > 0) {
    WriteAdditionalPropertiesToXml(writer, this._additionalProperties);
  }

  writer.WriteEndElement(); // Item/FolderShape
}