LoadUserSettingsFromXml method

Future<void> LoadUserSettingsFromXml(
  1. EwsXmlReader reader
)
Loads from XML. The reader.

Implementation

Future<void> LoadUserSettingsFromXml(EwsXmlReader reader) async {
  if (!reader.IsEmptyElement) {
    do {
      await reader.Read();

      if ((reader.NodeType == XmlNodeType.Element) &&
          (reader.LocalName == XmlElementNames.UserSetting)) {
        String? settingClass = reader.ReadAttributeValueWithNamespace(
            XmlNamespace.XmlSchemaInstance, XmlAttributeNames.Type);

        switch (settingClass) {
          case XmlElementNames.StringSetting:
          case XmlElementNames.WebClientUrlCollectionSetting:
          case XmlElementNames.AlternateMailboxCollectionSetting:
          case XmlElementNames.ProtocolConnectionCollectionSetting:
          case XmlElementNames.DocumentSharingLocationCollectionSetting:
            await this._ReadSettingFromXml(reader);
            break;

          default:
            EwsUtilities.Assert(
                false,
                "GetUserSettingsResponse.LoadUserSettingsFromXml",
                "Invalid setting class '$settingClass' returned");
            break;
        }
      }
    } while (!reader.IsEndElementWithNamespace(
        XmlNamespace.Autodiscover, XmlElementNames.UserSettings));
  }
}