LoadFromXml method
Future<void>
LoadFromXml(
- EwsServiceXmlReader reader,
- bool clear,
- PropertySet? requestedPropertySet,
- bool onlySummaryPropertiesRequested,
Implementation
Future<void> LoadFromXml(
EwsServiceXmlReader reader,
bool clear,
PropertySet? requestedPropertySet,
bool onlySummaryPropertiesRequested,
) async {
if (clear) {
Clear();
}
// Put the property bag in "loading" mode. When in loading mode, no checking is done
// when setting property values.
_loading = true;
_requestedPropertySet = requestedPropertySet;
_onlySummaryPropertiesRequested = onlySummaryPropertiesRequested;
try {
do {
await reader.Read();
if (reader.NodeType == XmlNodeType.Element) {
OutParam<PropertyDefinition> propertyDefinitionOutParam =
OutParam<PropertyDefinition>();
if (Owner!.Schema.TryGetPropertyDefinition(
reader.LocalName,
propertyDefinitionOutParam,
)) {
PropertyDefinition propertyDefinition =
propertyDefinitionOutParam.param!;
await propertyDefinition.LoadPropertyValueFromXml(reader, this);
_loadedProperties.add(propertyDefinition);
} else {
await reader.SkipCurrentElement();
}
}
} while (!reader.IsEndElementWithNamespace(
XmlNamespace.Types,
Owner!.GetXmlElementName(),
));
ClearChangeLog();
} finally {
_loading = false;
}
}