/// <summary>
        /// Try to get the value of a specified extended property in this instance.
        /// </summary>
        /// <param name="propertyDefinition">The property definition.</param>
        /// <param name="propertyValue">The property value.</param>
        /// <typeparam name="T">Type of expected property value.</typeparam>
        /// <returns>True if property retrieved, false otherwise.</returns>
        internal bool TryGetExtendedProperty <T>(ExtendedPropertyDefinition propertyDefinition, out T propertyValue)
        {
            ExtendedPropertyCollection propertyCollection = this.GetExtendedProperties();

            if ((propertyCollection != null) &&
                propertyCollection.TryGetValue <T>(propertyDefinition, out propertyValue))
            {
                return(true);
            }
            else
            {
                propertyValue = default(T);
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Load extended properties xml
        /// </summary>
        /// <param name="reader">The reader</param>
        /// <returns>Extended properties collection</returns>
        private static ExtendedPropertyCollection LoadExtendedPropertiesXml(EwsServiceXmlReader reader)
        {
            ExtendedPropertyCollection extendedProperties = new ExtendedPropertyCollection();

            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.ExtendedProperties);
            do
            {
                reader.Read();
                if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ExtendedProperty))
                {
                    extendedProperties.LoadFromXml(reader, XmlElementNames.ExtendedProperty);
                }
            }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.ExtendedProperties));

            return(extendedProperties.Count == 0 ? null : extendedProperties);
        }