예제 #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");
            }
        }
        /// <summary>
        /// Loads instance of WebClientUrlCollection from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal static WebClientUrlCollection LoadFromXml(EwsXmlReader reader)
        {
            WebClientUrlCollection instance = new WebClientUrlCollection();

            do
            {
                reader.Read();

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

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

            do
            {
                reader.Read();

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

            return instance;
        }
예제 #4
0
        /// <summary>
        /// Loads web client urls from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="webClientUrls">The web client urls.</param>
        /// <param name="elementName">Name of the element.</param>
        private static void LoadWebClientUrlsFromXml(EwsXmlReader reader, WebClientUrlCollection webClientUrls, string elementName)
        {
            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.LocalName)
                    {
                    case XmlElementNames.OWAUrl:
                        string       authMethod   = reader.ReadAttributeValue(XmlAttributeNames.AuthenticationMethod);
                        string       owaUrl       = reader.ReadElementValue();
                        WebClientUrl webClientUrl = new WebClientUrl(authMethod, owaUrl);
                        webClientUrls.Urls.Add(webClientUrl);
                        break;

                    default:
                        reader.SkipCurrentElement();
                        break;
                    }
                }
            }while (!reader.IsEndElement(XmlNamespace.NotSpecified, elementName));
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OutlookProtocol"/> class.
 /// </summary>
 internal OutlookProtocol()
 {
     this.internalOutlookWebAccessUrls = new WebClientUrlCollection();
     this.externalOutlookWebAccessUrls = new WebClientUrlCollection();
 }
        /// <summary>
        /// Loads web client urls from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="webClientUrls">The web client urls.</param>
        /// <param name="elementName">Name of the element.</param>
        private static void LoadWebClientUrlsFromXml(EwsXmlReader reader, WebClientUrlCollection webClientUrls, string elementName)
        {
            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.LocalName)
                    {
                        case XmlElementNames.OWAUrl:
                            string authMethod = reader.ReadAttributeValue(XmlAttributeNames.AuthenticationMethod);
                            string owaUrl = reader.ReadElementValue();
                            WebClientUrl webClientUrl = new WebClientUrl(authMethod, owaUrl);
                            webClientUrls.Urls.Add(webClientUrl);
                            break;
                        default:
                            reader.SkipCurrentElement();
                            break;
                    }
                }
            }
            while (!reader.IsEndElement(XmlNamespace.NotSpecified, elementName));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OutlookProtocol"/> class.
 /// </summary>
 internal OutlookProtocol()
 {
     this.internalOutlookWebAccessUrls = new WebClientUrlCollection();
     this.externalOutlookWebAccessUrls = new WebClientUrlCollection();
 }