Ejemplo n.º 1
0
        /// <summary>
        /// Loads instance of DocumentSharingLocationCollection from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>DocumentSharingLocationCollection</returns>
        internal static DocumentSharingLocationCollection LoadFromXml(EwsXmlReader reader)
        {
            DocumentSharingLocationCollection instance = new DocumentSharingLocationCollection();

            do
            {
                reader.Read();

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

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

            do
            {
                reader.Read();

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

                        case XmlElementNames.LocationUrl:
                            location.LocationUrl = reader.ReadElementValue<string>();
                            break;

                        case XmlElementNames.DisplayName:
                            location.DisplayName = reader.ReadElementValue<string>();
                            break;

                        case XmlElementNames.SupportedFileExtensions:
                            List<string> fileExtensions = new List<string>();
                            reader.Read();
                            while (reader.IsStartElement(XmlNamespace.Autodiscover, XmlElementNames.FileExtension))
                            {                                
                                string extension = reader.ReadElementValue<string>();
                                fileExtensions.Add(extension);
                                reader.Read();
                            }
                            
                            location.SupportedFileExtensions = fileExtensions;
                            break;

                        case XmlElementNames.ExternalAccessAllowed:
                            location.ExternalAccessAllowed = reader.ReadElementValue<bool>();
                            break;

                        case XmlElementNames.AnonymousAccessAllowed:
                            location.AnonymousAccessAllowed = reader.ReadElementValue<bool>();
                            break;

                        case XmlElementNames.CanModifyPermissions:
                            location.CanModifyPermissions = reader.ReadElementValue<bool>();
                            break;

                        case XmlElementNames.IsDefault:
                            location.IsDefault = reader.ReadElementValue<bool>();
                            break;

                        default:
                            break;
                    }
                }
            }
            while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.DocumentSharingLocation));

            return location;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads DocumentSharingLocation instance from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>DocumentSharingLocation.</returns>
        internal static DocumentSharingLocation LoadFromXml(EwsXmlReader reader)
        {
            DocumentSharingLocation location = new DocumentSharingLocation();

            do
            {
                reader.Read();

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

                    case XmlElementNames.LocationUrl:
                        location.LocationUrl = reader.ReadElementValue <string>();
                        break;

                    case XmlElementNames.DisplayName:
                        location.DisplayName = reader.ReadElementValue <string>();
                        break;

                    case XmlElementNames.SupportedFileExtensions:
                        List <string> fileExtensions = new List <string>();
                        reader.Read();
                        while (reader.IsStartElement(XmlNamespace.Autodiscover, XmlElementNames.FileExtension))
                        {
                            string extension = reader.ReadElementValue <string>();
                            fileExtensions.Add(extension);
                            reader.Read();
                        }

                        location.SupportedFileExtensions = fileExtensions;
                        break;

                    case XmlElementNames.ExternalAccessAllowed:
                        location.ExternalAccessAllowed = reader.ReadElementValue <bool>();
                        break;

                    case XmlElementNames.AnonymousAccessAllowed:
                        location.AnonymousAccessAllowed = reader.ReadElementValue <bool>();
                        break;

                    case XmlElementNames.CanModifyPermissions:
                        location.CanModifyPermissions = reader.ReadElementValue <bool>();
                        break;

                    case XmlElementNames.IsDefault:
                        location.IsDefault = reader.ReadElementValue <bool>();
                        break;

                    default:
                        break;
                    }
                }
            }while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.DocumentSharingLocation));

            return(location);
        }