LoadFromXml static method

ProtocolConnection LoadFromXml(
  1. EwsXmlReader reader
)
Read user setting with ProtocolConnection value. EwsServiceXmlReader

Implementation

static ProtocolConnection LoadFromXml(EwsXmlReader reader) {
  ProtocolConnection connection = new ProtocolConnection();

  do {
    reader.Read();

    if (reader.NodeType == XmlNodeType.Element) {
      switch (reader.LocalName) {
        case XmlElementNames.EncryptionMethod:
          connection.EncryptionMethod = reader.ReadElementValue<String>();
          break;
        case XmlElementNames.Hostname:
          connection.Hostname = reader.ReadElementValue<String>();
          break;
        case XmlElementNames.Port:
          connection.Port = reader.ReadElementValue<int>();
          break;
      }
    }
  } while (!reader.IsEndElementWithNamespace(
      XmlNamespace.Autodiscover, XmlElementNames.ProtocolConnection));

  return connection;
}