LoadFromXml method
Loads from XML.
The reader.
Implementation
Future<void> LoadFromXml(EwsServiceXmlReader reader) async {
await reader.ReadStartElementWithNamespace(
XmlNamespace.Messages,
XmlElementNames.UserConfiguration,
);
await reader.Read(); // Position at first property element
do {
if (reader.NodeType == XmlNodeType.Element) {
switch (reader.LocalName) {
case XmlElementNames.UserConfigurationName:
String? responseName = reader.ReadAttributeStringValue(
XmlAttributeNames.Name,
);
EwsUtilities.Assert(
_name == responseName,
"UserConfiguration.LoadFromXml",
"UserConfigurationName does not match: Expected: $_name Name in response: $responseName",
);
await reader.SkipCurrentElement();
break;
case XmlElementNames.ItemId:
_itemId = complex_properties.ItemId();
await _itemId!.LoadFromXml(reader, XmlElementNames.ItemId);
break;
case XmlElementNames.Dictionary:
await _dictionary.LoadFromXml(reader, XmlElementNames.Dictionary);
break;
case XmlElementNames.XmlData:
_xmlData = base64.decode(
await reader.ReadElementValue<String>() ?? "",
);
break;
case XmlElementNames.BinaryData:
_binaryData = base64.decode(
await reader.ReadElementValue<String>() ?? "",
);
break;
default:
EwsUtilities.Assert(
false,
"UserConfiguration.LoadFromXml",
"Xml element not supported: ${reader.LocalName}",
);
break;
}
}
// If XmlData was loaded, read is skipped because GetXmlData positions the reader at the next property.
await reader.Read();
} while (!reader.IsEndElementWithNamespace(
XmlNamespace.Messages,
XmlElementNames.UserConfiguration,
));
}