示例#1
0
        /// <summary>
        /// Reads user setting from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        private void ReadSettingFromXml(EwsXmlReader reader)
        {
            string name  = null;
            object value = null;

            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.LocalName)
                    {
                    case XmlElementNames.Name:
                        name = reader.ReadElementValue <string>();
                        break;

                    case XmlElementNames.Value:
                        value = reader.ReadElementValue();
                        break;

                    case XmlElementNames.WebClientUrls:
                        value = WebClientUrlCollection.LoadFromXml(reader);
                        break;

                    case XmlElementNames.ProtocolConnections:
                        value = ProtocolConnectionCollection.LoadFromXml(reader);
                        break;

                    case XmlElementNames.AlternateMailboxes:
                        value = AlternateMailboxCollection.LoadFromXml(reader);
                        break;

                    case XmlElementNames.DocumentSharingLocations:
                        value = DocumentSharingLocationCollection.LoadFromXml(reader);
                        break;
                    }
                }
            }while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.UserSetting));

            // EWS Managed API is broken with AutoDSvc endpoint in RedirectUrl scenario
            try
            {
                UserSettingName userSettingName = EwsUtilities.Parse <UserSettingName>(name);
                this.Settings.Add(userSettingName, value);
            }
            catch (ArgumentException)
            {
                // ignore unexpected UserSettingName in the response (due to the server-side bugs).
                // it'd be better if this is hooked into ITraceListener, but that is unavailable here.
                //
                // in case "name" is null, EwsUtilities.Parse throws ArgumentNullException
                // (which derives from ArgumentException).
                //
                EwsUtilities.Assert(
                    false,
                    "GetUserSettingsResponse.ReadSettingFromXml",
                    "Unexpected or empty name element in user setting");
            }
        }
示例#2
0
        /// <summary>
        /// Loads instance of AlternateMailboxCollection from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>AlternateMailboxCollection</returns>
        internal static AlternateMailboxCollection LoadFromXml(EwsXmlReader reader)
        {
            AlternateMailboxCollection instance = new AlternateMailboxCollection();

            do
            {
                reader.Read();

                if ((reader.NodeType == XmlNodeType.Element) && (reader.LocalName == XmlElementNames.AlternateMailbox))
                {
                    instance.Entries.Add(AlternateMailbox.LoadFromXml(reader));
                }
            }while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.AlternateMailboxes));

            return(instance);
        }
        /// <summary>
        /// Loads instance of AlternateMailboxCollection from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>AlternateMailboxCollection</returns>
        internal static AlternateMailboxCollection LoadFromXml(EwsXmlReader reader)
        {
            AlternateMailboxCollection instance = new AlternateMailboxCollection();

            do
            {
                reader.Read();

                if ((reader.NodeType == XmlNodeType.Element) && (reader.LocalName == XmlElementNames.AlternateMailbox))
                {
                    instance.Entries.Add(AlternateMailbox.LoadFromXml(reader));
                }
            }
            while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.AlternateMailboxes));

            return instance;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OutlookAccount"/> class.
 /// </summary>
 internal OutlookAccount()
 {
     this.protocols          = new Dictionary <OutlookProtocolType, OutlookProtocol>();
     this.alternateMailboxes = new AlternateMailboxCollection();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OutlookAccount"/> class.
 /// </summary>
 internal OutlookAccount()
 {
     this.protocols = new Dictionary<OutlookProtocolType, OutlookProtocol>();
     this.alternateMailboxes = new AlternateMailboxCollection();
 }