WriteToXml method
Writes the bag's properties to XML.
The writer to write the properties to.
Implementation
void WriteToXml(EwsServiceXmlWriter writer) {
writer.WriteStartElement(XmlNamespace.Types, Owner!.GetXmlElementName());
for (PropertyDefinition propertyDefinition in Owner!.Schema) {
// The following test should not be necessary since the property bag prevents
// properties to be set if they don't have the CanSet flag, but it doesn't hurt...
if (propertyDefinition.HasFlag(
PropertyDefinitionFlags.CanSet,
writer.Service.RequestedServerVersion,
)) {
if (Contains(propertyDefinition)) {
propertyDefinition.WritePropertyValueToXml(
writer,
this,
false /* isUpdateOperation */,
);
}
}
}
writer.WriteEndElement();
}