예제 #1
0
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            // Emit the EmailAddress element
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Email);
            writer.WriteValue(this.EmailAddress, XmlElementNames.Email);
            writer.WriteEndElement();

            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SizeRequested);
            writer.WriteValue(this.UserPhotoSize, XmlElementNames.SizeRequested);
            writer.WriteEndElement();
        }
예제 #2
0
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            // Emit the EmailAddress element
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Email);
            writer.WriteValue(this.EmailAddress, XmlElementNames.Email);
            writer.WriteEndElement();

            string encodedPhoto = Convert.ToBase64String(this.Photo);

            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Content);
            writer.WriteValue(encodedPhoto, XmlElementNames.Content);
            writer.WriteEndElement();
        }
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     if (this.retentionId != Guid.Empty)
     {
         writer.WriteValue(this.retentionId.ToString(), this.xmlElementName);
     }
 }
예제 #4
0
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            this.View.WriteToXml(writer, this.GetGroupBy());

            if (this.SearchFilter != null)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Restriction);
                this.SearchFilter.WriteToXml(writer);
                writer.WriteEndElement(); // Restriction
            }

            this.View.WriteOrderByToXml(writer);

            this.ParentFolderIds.WriteToXml(
                writer,
                XmlNamespace.Messages,
                XmlElementNames.ParentFolderIds);

            if (!string.IsNullOrEmpty(this.queryString))
            {
                // Emit the QueryString
                //
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.QueryString);

                if (this.ReturnHighlightTerms)
                {
                    writer.WriteAttributeString(XmlAttributeNames.ReturnHighlightTerms, this.ReturnHighlightTerms.ToString().ToLowerInvariant());
                }

                writer.WriteValue(this.queryString, XmlElementNames.QueryString);
                writer.WriteEndElement();
            }
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.To);

            if (this.targetPeriod != null)
            {
                writer.WriteAttributeValue(XmlAttributeNames.Kind, PeriodTarget);
                writer.WriteValue(this.targetPeriod.Id, XmlElementNames.To);
            }
            else
            {
                writer.WriteAttributeValue(XmlAttributeNames.Kind, GroupTarget);
                writer.WriteValue(this.targetGroup.Id, XmlElementNames.To);
            }

            writer.WriteEndElement(); // To
        }
예제 #6
0
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     foreach (string item in this)
     {
         writer.WriteStartElement(XmlNamespace.Types, this.itemXmlElementName);
         writer.WriteValue(item, this.itemXmlElementName);
         writer.WriteEndElement();
     }
 }
        /// <summary>
        /// Writes a dictionary entry value to Xml.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="value">Value to write.</param>
        private void WriteEntryValueToXml(EwsServiceXmlWriter writer, string value)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Value);

            // While an entry value can't be null, if the entry is an array, an element of the array can be null.
            if (value != null)
            {
                writer.WriteValue(value, XmlElementNames.Value);
            }

            writer.WriteEndElement();
        }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            // Emit the view element
            //
            this.View.WriteToXml(writer, null);

            // Emit the Sort Order
            //
            this.View.WriteOrderByToXml(writer);

            // Emit the Parent Folder Id
            //
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ParentFolderId);
            this.FolderId.WriteToXml(writer);
            writer.WriteEndElement();

            // Emit the MailboxScope flag
            //
            if (this.MailboxScope.HasValue)
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MailboxScope, this.MailboxScope.Value);
            }

            if (!string.IsNullOrEmpty(this.queryString))
            {
                // Emit the QueryString
                //
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.QueryString);

                if (this.ReturnHighlightTerms)
                {
                    writer.WriteAttributeString(XmlAttributeNames.ReturnHighlightTerms, this.ReturnHighlightTerms.ToString().ToLowerInvariant());
                }

                writer.WriteValue(this.queryString, XmlElementNames.QueryString);
                writer.WriteEndElement();
            }

            if (this.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013)
            {
                if (this.View.PropertySet != null)
                {
                    this.View.PropertySet.WriteToXml(writer, ServiceObjectType.Conversation);
                }
            }
        }
        /// <summary>
        /// Writes the property value to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="propertyBag">The property bag.</param>
        /// <param name="isUpdateOperation">Indicates whether the context is an update operation.</param>
        internal override void WritePropertyValueToXml(
            EwsServiceXmlWriter writer,
            PropertyBag propertyBag,
            bool isUpdateOperation)
        {
            object value = propertyBag[this];

            if (value != null)
            {
                writer.WriteStartElement(XmlNamespace.Types, this.XmlElementName);

                DateTime convertedDateTime = GetConvertedDateTime(writer.Service, propertyBag, isUpdateOperation, value);

                writer.WriteValue(EwsUtilities.DateTimeToXSDateTime(convertedDateTime), this.Name);

                writer.WriteEndElement();
            }
        }
        /// <summary>
        /// Writes a byte array to Xml.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="byteArray">Byte array to write.</param>
        /// <param name="xmlElementName">Name of the Xml element.</param>
        private static void WriteByteArrayToXml(
            EwsServiceXmlWriter writer,
            byte[] byteArray,
            string xmlElementName)
        {
            EwsUtilities.Assert(
                writer != null,
                "UserConfiguration.WriteByteArrayToXml",
                "writer is null");
            EwsUtilities.Assert(
                xmlElementName != null,
                "UserConfiguration.WriteByteArrayToXml",
                "xmlElementName is null");

            writer.WriteStartElement(XmlNamespace.Types, xmlElementName);

            if (byteArray != null && byteArray.Length > 0)
            {
                writer.WriteValue(Convert.ToBase64String(byteArray), xmlElementName);
            }

            writer.WriteEndElement();
        }
예제 #11
0
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteValue(this.EmailAddress.Address, XmlElementNames.EmailAddress);
 }
예제 #12
0
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteValue(this.PhoneNumber, XmlElementNames.PhoneNumber);
 }
예제 #13
0
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (this.SearchFilter != null)
            {
                // Emit the Restriction element
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Restriction);
                this.SearchFilter.WriteToXml(writer);
                writer.WriteEndElement();
            }

            // Emit the View element
            this.View.WriteToXml(writer, null);

            // Emit the SortOrder
            this.View.WriteOrderByToXml(writer);

            // Emit the ParentFolderId element
            if (this.FolderId != null)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ParentFolderId);
                this.FolderId.WriteToXml(writer);
                writer.WriteEndElement();
            }

            if (!string.IsNullOrEmpty(this.QueryString))
            {
                // Emit the QueryString element
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.QueryString);
                writer.WriteValue(this.QueryString, XmlElementNames.QueryString);
                writer.WriteEndElement();
            }

            // Emit the SuggestionIndex-enabled elements
            if (this.SearchPeopleSuggestionIndex)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchPeopleSuggestionIndex);
                writer.WriteValue(this.SearchPeopleSuggestionIndex.ToString().ToLowerInvariant(), XmlElementNames.SearchPeopleSuggestionIndex);
                writer.WriteEndElement();

                // Write the Context key value pairs
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchPeopleContext);
                foreach (KeyValuePair<string, string> contextItem in this.Context)
                {
                    writer.WriteStartElement(XmlNamespace.Messages, "ContextProperty");

                    writer.WriteStartElement(XmlNamespace.Messages, "Key");
                    writer.WriteValue(contextItem.Key, "Key");
                    writer.WriteEndElement();

                    writer.WriteStartElement(XmlNamespace.Messages, "Value");
                    writer.WriteValue(contextItem.Value, "Value");
                    writer.WriteEndElement();

                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                // Write the Query Mode Sources
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchPeopleQuerySources);
                foreach (string querySource in this.QueryMode.Sources)
                {
                    writer.WriteStartElement(XmlNamespace.Messages, "Source");
                    writer.WriteValue(querySource, "Source");
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }

            if (this.Service.RequestedServerVersion >= this.GetMinimumRequiredServerVersion())
            {
                if (this.View.PropertySet != null)
                {
                    this.View.PropertySet.WriteToXml(writer, ServiceObjectType.Persona);
                }
            }
        }
예제 #14
0
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteValue(this.Value, this.Name);
 }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            // Emit the EmailAddress element
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Email);
            writer.WriteValue(this.EmailAddress, XmlElementNames.Email);
            writer.WriteEndElement();

            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SizeRequested);
            writer.WriteValue(this.UserPhotoSize, XmlElementNames.SizeRequested);
            writer.WriteEndElement();
        }
        /// <summary>
        /// Writes a dictionary entry value to Xml.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="value">Value to write.</param>
        private void WriteEntryValueToXml(EwsServiceXmlWriter writer, string value)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Value);

            // While an entry value can't be null, if the entry is an array, an element of the array can be null.
            if (value != null)
            {
                writer.WriteValue(value, XmlElementNames.Value);
            }

            writer.WriteEndElement();
        }
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     if (this.retentionId != Guid.Empty)
     {
         writer.WriteValue(this.retentionId.ToString(), this.xmlElementName);
     }
 }
 /// <summary>
 /// Writes a dictionary entry type to Xml.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="dictionaryObjectType">Type to write.</param>
 private void WriteEntryTypeToXml(EwsServiceXmlWriter writer, UserConfigurationDictionaryObjectType dictionaryObjectType)
 {
     writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Type);
     writer.WriteValue(dictionaryObjectType.ToString(), XmlElementNames.Type);
     writer.WriteEndElement();
 }
 /// <summary>
 /// Writes a dictionary entry type to Xml.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="dictionaryObjectType">Type to write.</param>
 private void WriteEntryTypeToXml(EwsServiceXmlWriter writer, UserConfigurationDictionaryObjectType dictionaryObjectType)
 {
     writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Type);
     writer.WriteValue(dictionaryObjectType.ToString(), XmlElementNames.Type);
     writer.WriteEndElement();
 }
        /// <summary>
        /// Writes a byte array to Xml.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="byteArray">Byte array to write.</param>
        /// <param name="xmlElementName">Name of the Xml element.</param>
        private static void WriteByteArrayToXml(
            EwsServiceXmlWriter writer,
            byte[] byteArray,
            string xmlElementName)
        {
            EwsUtilities.Assert(
                writer != null,
                "UserConfiguration.WriteByteArrayToXml",
                "writer is null");
            EwsUtilities.Assert(
                xmlElementName != null,
                "UserConfiguration.WriteByteArrayToXml",
                "xmlElementName is null");

            writer.WriteStartElement(XmlNamespace.Types, xmlElementName);

            if (byteArray != null && byteArray.Length > 0)
            {
                writer.WriteValue(Convert.ToBase64String(byteArray), xmlElementName);
            }

            writer.WriteEndElement();
        }
예제 #21
0
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (this.SearchFilter != null)
            {
                // Emit the Restriction element
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Restriction);
                this.SearchFilter.WriteToXml(writer);
                writer.WriteEndElement();
            }

            // Emit the View element
            this.View.WriteToXml(writer, null);

            // Emit the SortOrder
            this.View.WriteOrderByToXml(writer);

            // Emit the ParentFolderId element
            if (this.FolderId != null)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ParentFolderId);
                this.FolderId.WriteToXml(writer);
                writer.WriteEndElement();
            }

            if (!string.IsNullOrEmpty(this.QueryString))
            {
                // Emit the QueryString element
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.QueryString);
                writer.WriteValue(this.QueryString, XmlElementNames.QueryString);
                writer.WriteEndElement();
            }

            // Emit the SuggestionIndex-enabled elements
            if (this.SearchPeopleSuggestionIndex)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchPeopleSuggestionIndex);
                writer.WriteValue(this.SearchPeopleSuggestionIndex.ToString().ToLowerInvariant(), XmlElementNames.SearchPeopleSuggestionIndex);
                writer.WriteEndElement();

                // Write the Context key value pairs
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchPeopleContext);
                foreach (KeyValuePair <string, string> contextItem in this.Context)
                {
                    writer.WriteStartElement(XmlNamespace.Types, "ContextProperty");

                    writer.WriteStartElement(XmlNamespace.Types, "Key");
                    writer.WriteValue(contextItem.Key, "Key");
                    writer.WriteEndElement();

                    writer.WriteStartElement(XmlNamespace.Types, "Value");
                    writer.WriteValue(contextItem.Value, "Value");
                    writer.WriteEndElement();

                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                // Write the Query Mode Sources
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchPeopleQuerySources);
                foreach (string querySource in this.QueryMode.Sources)
                {
                    writer.WriteStartElement(XmlNamespace.Types, "Source");
                    writer.WriteValue(querySource, "Source");
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }

            if (this.Service.RequestedServerVersion >= this.GetMinimumRequiredServerVersion())
            {
                if (this.View.PropertySet != null)
                {
                    this.View.PropertySet.WriteToXml(writer, ServiceObjectType.Persona);
                }
            }
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.To);

            if (this.targetPeriod != null)
            {
                writer.WriteAttributeValue(XmlAttributeNames.Kind, PeriodTarget);
                writer.WriteValue(this.targetPeriod.Id, XmlElementNames.To);
            }
            else
            {
                writer.WriteAttributeValue(XmlAttributeNames.Kind, GroupTarget);
                writer.WriteValue(this.targetGroup.Id, XmlElementNames.To);
            }

            writer.WriteEndElement(); // To
        }
예제 #23
0
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteValue(this.Value, this.Name);
 }
        /// <summary>
        /// Writes the property value to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="propertyBag">The property bag.</param>
        /// <param name="isUpdateOperation">Indicates whether the context is an update operation.</param>
        internal override void WritePropertyValueToXml(
            EwsServiceXmlWriter writer,
            PropertyBag propertyBag,
            bool isUpdateOperation)
        {
            object value = propertyBag[this];

            if (value != null)
            {
                writer.WriteStartElement(XmlNamespace.Types, this.XmlElementName);

                DateTime convertedDateTime = GetConvertedDateTime(writer.Service, propertyBag, isUpdateOperation, value);

                writer.WriteValue(EwsUtilities.DateTimeToXSDateTime(convertedDateTime), this.Name);

                writer.WriteEndElement();
            }
        }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            // Emit the view element
            //
            this.View.WriteToXml(writer, null);

            // Emit the Sort Order
            //
            this.View.WriteOrderByToXml(writer);

            // Emit the Parent Folder Id
            //
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ParentFolderId);
            this.FolderId.WriteToXml(writer);
            writer.WriteEndElement();

            // Emit the MailboxScope flag
            // 
            if (this.MailboxScope.HasValue)
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MailboxScope, this.MailboxScope.Value);
            }

            if (!string.IsNullOrEmpty(this.queryString))
            {
                // Emit the QueryString
                //
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.QueryString);

                if (this.ReturnHighlightTerms)
                {
                    writer.WriteAttributeString(XmlAttributeNames.ReturnHighlightTerms, this.ReturnHighlightTerms.ToString().ToLowerInvariant());
                }

                writer.WriteValue(this.queryString, XmlElementNames.QueryString);
                writer.WriteEndElement();
            }

            if (this.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013)
            {
                if (this.View.PropertySet != null)
                {
                    this.View.PropertySet.WriteToXml(writer, ServiceObjectType.Conversation);
                }
            }
        }