/// <summary>
 /// Writes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="xmlElementName">Name of the XML element.</param>
 internal override void WriteToXml(EwsServiceXmlWriter writer, string xmlElementName)
 {
     writer.WriteStartElement(XmlNamespace.Types, xmlElementName);
     writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.GroupIdentityType, this.IdentityType.ToString());
     writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.GroupIdentityValue, this.Value);
     writer.WriteEndElement();
 }
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="xmlElementName">Name of the XML element.</param>
        internal override void WriteToXml(EwsServiceXmlWriter writer, string xmlElementName)
        {
            writer.WriteStartElement(XmlNamespace.Types, xmlElementName);
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.SortType, this.SortType.ToString());
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.FilterType, this.FilterType.ToString());
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.SortDirection, this.SortDirection.ToString());

            writer.WriteEndElement();
        }
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="xmlElementName">Name of the XML element.</param>
        internal override void WriteToXml(EwsServiceXmlWriter writer, string xmlElementName)
        {
            writer.WriteStartElement(XmlNamespace.Types, xmlElementName);

            this.ConversationId.WriteToXml(writer);

            if (this.SyncState != null)
            {
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.SyncState, this.SyncState);
            }

            writer.WriteEndElement();
        }
Esempio n. 4
0
    /// <summary>
    /// Writes to XML.
    /// </summary>
    /// <param name="writer">The writer.</param>
    /// <param name="xmlNamespace">The XML namespace.</param>
    /// <param name="xmlElementName">Name of the XML element.</param>
    void WriteToXml(
        EwsServiceXmlWriter writer,
        XmlNamespace xmlNamespace,
        String xmlElementName)
    {
        EwsUtilities.Assert(
            writer != null,
            "UserConfiguration.WriteToXml",
            "writer is null");
        EwsUtilities.Assert(
            xmlElementName != null,
            "UserConfiguration.WriteToXml",
            "xmlElementName is null");

        writer.WriteStartElement(xmlNamespace, xmlElementName);

        // Write the UserConfigurationName element
        WriteUserConfigurationNameToXml(
            writer,
            XmlNamespace.Types,
            this.name,
            this.parentFolderId);

        // Write the Dictionary element
        if (this.IsPropertyUpdated(UserConfigurationProperties.Dictionary))
        {
            this.dictionary.WriteToXml(writer, XmlElementNames.Dictionary);
        }

        // Write the XmlData element
        if (this.IsPropertyUpdated(UserConfigurationProperties.XmlData))
        {
            this.WriteXmlDataToXml(writer);
        }

        // Write the BinaryData element
        if (this.IsPropertyUpdated(UserConfigurationProperties.BinaryData))
        {
            this.WriteBinaryDataToXml(writer);
        }

        writer.WriteEndElement();
    }
Esempio n. 5
0
    /// <summary>
    /// Writes to XML.
    /// </summary>
    /// <param name="writer">The writer.</param>
    /// <param name="xmlElementName">Name of the XML element.</param>
    void WriteToXml(EwsServiceXmlWriter writer, String xmlElementName)
    {
        writer.WriteStartElement(XmlNamespace.Types, xmlElementName);

        if (this.Culture != null)
        {
            writer.WriteAttributeValue(
                "xml",
                "lang",
                this.Culture);
        }

        writer.WriteElementValue(
            XmlNamespace.Types,
            XmlElementNames.Message,
            this.Message);

        writer.WriteEndElement();     // xmlElementName
    }
Esempio n. 6
0
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Manifest);

        writer.WriteBase64ElementValue(manifestStream);

        if (!StringUtils.IsNullOrEmpty(this.marketplaceAssetId))
        {
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MarketplaceAssetId, this.marketplaceAssetId);

            if (!StringUtils.IsNullOrEmpty(this.marketplaceContentMarket))
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MarketplaceContentMarket, this.marketplaceContentMarket);
            }

            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.SendWelcomeEmail, this.sendWelcomeEmail);
        }

        writer.WriteEndElement();
    }
Esempio n. 7
0
    /// <summary>
    /// Writes to XML.
    /// </summary>
    /// <param name="writer">The writer.</param>
    /// <param name="xmlElementName">Name of the XML element.</param>
    /// <param name="startTime">The start time.</param>
    /// <param name="endTime">The end time.</param>
    /* private */ static void WriteToXml(
        EwsServiceXmlWriter writer,
        String xmlElementName,
        object startTime,
        object endTime)
    {
        writer.WriteStartElement(XmlNamespace.Types, xmlElementName);

        writer.WriteElementValue(
            XmlNamespace.Types,
            XmlElementNames.StartTime,
            startTime);

        writer.WriteElementValue(
            XmlNamespace.Types,
            XmlElementNames.EndTime,
            endTime);

        writer.WriteEndElement();     // xmlElementName
    }
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        base.WriteElementsToXml(writer);

        writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.DelegateUsers);

        for (DelegateUser delegateUser in this.DelegateUsers)
        {
            delegateUser.WriteToXml(writer, XmlElementNames.DelegateUser);
        }

        writer.WriteEndElement();     // DelegateUsers

        if (this.MeetingRequestsDeliveryScope.HasValue)
        {
            writer.WriteElementValue(
                XmlNamespace.Messages,
                XmlElementNames.DeliverMeetingRequests,
                this.MeetingRequestsDeliveryScope.Value);
        }
    }
Esempio n. 9
0
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        if (!StringUtils.IsNullOrEmpty(this.mailboxSmtpAddress))
        {
            writer.WriteElementValue(
                XmlNamespace.Messages,
                XmlElementNames.MailboxSmtpAddress,
                this.mailboxSmtpAddress);
        }

        writer.WriteElementValue(
            XmlNamespace.Messages,
            XmlElementNames.RemoveOutlookRuleBlob,
            this.RemoveOutlookRuleBlob);
        writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Operations);
        for (RuleOperation operation in this.inboxRuleOperations)
        {
            operation.WriteToXml(writer, operation.XmlElementName);
        }
        writer.WriteEndElement();
    }
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        // Only serialize the TimeZone property against an Exchange 2007 SP1 server.
        // Against Exchange 2010, the time zone is emitted in the request's SOAP header.
        if (writer.Service.RequestedServerVersion == ExchangeVersion.Exchange2007_SP1)
        {
            LegacyAvailabilityTimeZone legacyTimeZone = new LegacyAvailabilityTimeZone(writer.Service.TimeZone);

            legacyTimeZone.WriteToXml(writer, XmlElementNames.TimeZone);
        }

        writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.MailboxDataArray);

        for (AttendeeInfo attendee in this.Attendees)
        {
            attendee.WriteToXml(writer);
        }

        writer.WriteEndElement();     // MailboxDataArray

        this.Options.WriteToXml(writer, this);
    }
Esempio n. 11
0
    /// <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,
        Uint8List 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();
    }
Esempio n. 12
0
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        EwsUtilities.Assert(
            writer != null,
            "UserConfigurationDictionary.WriteElementsToXml",
            "writer is null");

        for (MapEntry <object, object> dictionaryEntry in this.dictionary)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.DictionaryEntry);

            this.WriteObjectToXml(
                writer,
                XmlElementNames.DictionaryKey,
                dictionaryEntry.Key);

            this.WriteObjectToXml(
                writer,
                XmlElementNames.DictionaryValue,
                dictionaryEntry.Value);

            writer.WriteEndElement();
        }
    }
Esempio n. 13
0
    /// <summary>
    /// Writes to XML.
    /// </summary>
    /// <param name="writer">The writer.</param>
    /// <param name="request">The request being emitted.</param>
    void WriteToXml(EwsServiceXmlWriter writer, GetUserAvailabilityRequest request)
    {
        if (request.IsFreeBusyViewRequested)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.FreeBusyViewOptions);

            request.TimeWindow.WriteToXmlUnscopedDatesOnly(writer, XmlElementNames.TimeWindow);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.MergedFreeBusyIntervalInMinutes,
                this.MergedFreeBusyInterval);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.RequestedView,
                this.RequestedFreeBusyView);

            writer.WriteEndElement();     // FreeBusyViewOptions
        }

        if (request.IsSuggestionsViewRequested)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.SuggestionsViewOptions);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.GoodThreshold,
                this.GoodSuggestionThreshold);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.MaximumResultsByDay,
                this.MaximumSuggestionsPerDay);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.MaximumNonWorkHourResultsByDay,
                this.MaximumNonWorkHoursSuggestionsPerDay);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.MeetingDurationInMinutes,
                this.MeetingDuration);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.MinimumSuggestionQuality,
                this.MinimumSuggestionQuality);

            TimeWindow timeWindowToSerialize = this.DetailedSuggestionsWindow == null ?
                                               request.TimeWindow :
                                               this.DetailedSuggestionsWindow;

            timeWindowToSerialize.WriteToXmlUnscopedDatesOnly(writer, XmlElementNames.DetailedSuggestionsWindow);

            if (this.CurrentMeetingTime.HasValue)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.CurrentMeetingTime,
                    this.CurrentMeetingTime.Value);
            }

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.GlobalObjectId,
                this.GlobalObjectId);

            writer.WriteEndElement();     // SuggestionsViewOptions
        }
    }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.RequestedGroupsSets);

            if (this.RequestedUnifiedGroupsSets != null)
            { 
                this.RequestedUnifiedGroupsSets.ForEach((unifiedGroupsSet) => unifiedGroupsSet.WriteToXml(writer, XmlElementNames.RequestedUnifiedGroupsSetItem));
            }

            writer.WriteEndElement();

            if (!string.IsNullOrEmpty(this.UserSmtpAddress))
            {
                writer.WriteElementValue(XmlNamespace.NotSpecified, XmlElementNames.UserSmtpAddress, this.UserSmtpAddress);
            }
        }
Esempio n. 15
0
 /// <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();
 }
Esempio n. 16
0
    /// <summary>
    /// Writes XML elements.
    /// </summary>
    /// <param name="writer">The writer.</param>
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        writer.WriteStartElement(
            XmlNamespace.Types,
            XmlElementNames.ConversationAction);
        try
        {
            String actionValue = String.Empty;
            switch (this.Action)
            {
            case ConversationActionType.AlwaysCategorize:
                actionValue = XmlElementNames.AlwaysCategorize;
                break;

            case ConversationActionType.AlwaysDelete:
                actionValue = XmlElementNames.AlwaysDelete;
                break;

            case ConversationActionType.AlwaysMove:
                actionValue = XmlElementNames.AlwaysMove;
                break;

            case ConversationActionType.Delete:
                actionValue = XmlElementNames.Delete;
                break;

            case ConversationActionType.Copy:
                actionValue = XmlElementNames.Copy;
                break;

            case ConversationActionType.Move:
                actionValue = XmlElementNames.Move;
                break;

            case ConversationActionType.SetReadState:
                actionValue = XmlElementNames.SetReadState;
                break;

            case ConversationActionType.SetRetentionPolicy:
                actionValue = XmlElementNames.SetRetentionPolicy;
                break;

            case ConversationActionType.Flag:
                actionValue = XmlElementNames.Flag;
                break;

            default:
                throw new ArgumentError("ConversationAction");
            }

            // Emit the action element
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.Action,
                actionValue);

            // Emit the conversation id element
            this.ConversationId.WriteToXml(
                writer,
                XmlNamespace.Types,
                XmlElementNames.ConversationId);

            if (this.Action == ConversationActionType.AlwaysCategorize ||
                this.Action == ConversationActionType.AlwaysDelete ||
                this.Action == ConversationActionType.AlwaysMove)
            {
                // Emit the ProcessRightAway element
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.ProcessRightAway,
                    EwsUtilities.BoolToXSBool(this.ProcessRightAway));
            }

            if (this.Action == ConversationActionType.AlwaysCategorize)
            {
                // Emit the categories element
                if (this.Categories != null && this.Categories.Count > 0)
                {
                    this.Categories.WriteToXml(
                        writer,
                        XmlNamespace.Types,
                        XmlElementNames.Categories);
                }
            }
            else if (this.Action == ConversationActionType.AlwaysDelete)
            {
                // Emit the EnableAlwaysDelete element
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.EnableAlwaysDelete,
                    EwsUtilities.BoolToXSBool(this.EnableAlwaysDelete));
            }
            else if (this.Action == ConversationActionType.AlwaysMove)
            {
                // Emit the Move Folder Id
                if (this.DestinationFolderId != null)
                {
                    writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.DestinationFolderId);
                    this.DestinationFolderId.WriteToXml(writer);
                    writer.WriteEndElement();
                }
            }
            else
            {
                if (this.ContextFolderId != null)
                {
                    writer.WriteStartElement(
                        XmlNamespace.Types,
                        XmlElementNames.ContextFolderId);

                    this.ContextFolderId.WriteToXml(writer);

                    writer.WriteEndElement();
                }

                if (this.ConversationLastSyncTime.HasValue)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.ConversationLastSyncTime,
                        this.ConversationLastSyncTime.Value);
                }

                if (this.Action == ConversationActionType.Copy)
                {
                    EwsUtilities.Assert(
                        this.DestinationFolderId != null,
                        "ApplyconversationActionRequest",
                        "DestinationFolderId should be set when performing copy action");

                    writer.WriteStartElement(
                        XmlNamespace.Types,
                        XmlElementNames.DestinationFolderId);
                    this.DestinationFolderId.WriteToXml(writer);
                    writer.WriteEndElement();
                }
                else if (this.Action == ConversationActionType.Move)
                {
                    EwsUtilities.Assert(
                        this.DestinationFolderId != null,
                        "ApplyconversationActionRequest",
                        "DestinationFolderId should be set when performing move action");

                    writer.WriteStartElement(
                        XmlNamespace.Types,
                        XmlElementNames.DestinationFolderId);
                    this.DestinationFolderId.WriteToXml(writer);
                    writer.WriteEndElement();
                }
                else if (this.Action == ConversationActionType.Delete)
                {
                    EwsUtilities.Assert(
                        this.DeleteType.HasValue,
                        "ApplyconversationActionRequest",
                        "DeleteType should be specified when deleting a conversation.");

                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.DeleteType,
                        this.DeleteType.Value);
                }
                else if (this.Action == ConversationActionType.SetReadState)
                {
                    EwsUtilities.Assert(
                        this.IsRead.HasValue,
                        "ApplyconversationActionRequest",
                        "IsRead should be specified when marking/unmarking a conversation as read.");

                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.IsRead,
                        this.IsRead.Value);

                    if (this.SuppressReadReceipts.HasValue)
                    {
                        writer.WriteElementValue(
                            XmlNamespace.Types,
                            XmlElementNames.SuppressReadReceipts,
                            this.SuppressReadReceipts.Value);
                    }
                }
                else if (this.Action == ConversationActionType.SetRetentionPolicy)
                {
                    EwsUtilities.Assert(
                        this.RetentionPolicyType.HasValue,
                        "ApplyconversationActionRequest",
                        "RetentionPolicyType should be specified when setting a retention policy on a conversation.");

                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.RetentionPolicyType,
                        this.RetentionPolicyType.Value);

                    if (this.RetentionPolicyTagId.HasValue)
                    {
                        writer.WriteElementValue(
                            XmlNamespace.Types,
                            XmlElementNames.RetentionPolicyTagId,
                            this.RetentionPolicyTagId.Value);
                    }
                }
                else if (this.Action == ConversationActionType.Flag)
                {
                    EwsUtilities.Assert(
                        this.Flag != null,
                        "ApplyconversationActionRequest",
                        "Flag should be specified when flagging conversation items.");

                    writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Flag);
                    this.Flag.WriteElementsToXml(writer);
                    writer.WriteEndElement();
                }
            }
        }
        finally
        {
            writer.WriteEndElement();
        }
    }
Esempio n. 17
0
    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 (!StringUtils.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);
            for (MapEntry <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);
            for (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 to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="groupBy">The group by clause.</param>
        internal override void WriteToXml(EwsServiceXmlWriter writer, Grouping groupBy)
        {
            writer.WriteStartElement(XmlNamespace.Messages, this.GetViewXmlElementName());

            this.InternalWriteViewToXml(writer);

            writer.WriteEndElement();
        }
        /// <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();
            }

            if (this.Service.RequestedServerVersion >= this.GetMinimumRequiredServerVersion())
            {
                if (this.View.PropertySet != null)
                {
                    this.View.PropertySet.WriteToXml(writer, ServiceObjectType.Persona);
                }
            }
        }
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchQueries);
        for (MailboxQuery mailboxQuery in this.SearchQueries)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MailboxQuery);
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Query, mailboxQuery.Query);
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MailboxSearchScopes);
            for (MailboxSearchScope mailboxSearchScope in mailboxQuery.MailboxSearchScopes)
            {
                // The checks here silently downgrade the schema based on compatibility checks, to receive errors use the validate method
                if (mailboxSearchScope.SearchScopeType == MailboxSearchScopeType.LegacyExchangeDN || DiscoverySchemaChanges.SearchMailboxesAdditionalSearchScopes.IsCompatible(this))
                {
                    writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MailboxSearchScope);
                    writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Mailbox, mailboxSearchScope.Mailbox);
                    writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.SearchScope, mailboxSearchScope.SearchScope);

                    if (DiscoverySchemaChanges.SearchMailboxesExtendedData.IsCompatible(this))
                    {
                        writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ExtendedAttributes);

                        if (mailboxSearchScope.SearchScopeType != MailboxSearchScopeType.LegacyExchangeDN)
                        {
                            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ExtendedAttribute);
                            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeName, XmlElementNames.SearchScopeType);
                            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeValue, mailboxSearchScope.SearchScopeType);
                            writer.WriteEndElement();
                        }

                        if (mailboxSearchScope.ExtendedAttributes != null && mailboxSearchScope.ExtendedAttributes.Count > 0)
                        {
                            for (ExtendedAttribute attribute in mailboxSearchScope.ExtendedAttributes)
                            {
                                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ExtendedAttribute);
                                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeName, attribute.Name);
                                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeValue, attribute.Value);
                                writer.WriteEndElement();
                            }
                        }

                        writer.WriteEndElement();      // ExtendedData
                    }

                    writer.WriteEndElement();       // MailboxSearchScope
                }
            }

            writer.WriteEndElement();       // MailboxSearchScopes
            writer.WriteEndElement();       // MailboxQuery
        }

        writer.WriteEndElement();       // SearchQueries
        writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ResultType, this.ResultType);

        if (this.PreviewItemResponseShape != null)
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.PreviewItemResponseShape);
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.BaseShape, this.PreviewItemResponseShape.BaseShape);
            if (this.PreviewItemResponseShape.AdditionalProperties != null && this.PreviewItemResponseShape.AdditionalProperties.Length > 0)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.AdditionalProperties);
                for (ExtendedPropertyDefinition additionalProperty in this.PreviewItemResponseShape.AdditionalProperties)
                {
                    additionalProperty.WriteToXml(writer);
                }

                writer.WriteEndElement();       // AdditionalProperties
            }

            writer.WriteEndElement();       // PreviewItemResponseShape
        }

        if (!StringUtils.IsNullOrEmpty(this.SortByProperty))
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SortBy);
            writer.WriteAttributeValue(XmlElementNames.Order, this.SortOrder.ToString());
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.FieldURI);
            writer.WriteAttributeValue(XmlElementNames.FieldURI, this.sortByProperty);
            writer.WriteEndElement();       // FieldURI
            writer.WriteEndElement();       // SortBy
        }

        // Language
        if (!StringUtils.IsNullOrEmpty(this.Language))
        {
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.Language, this.Language);
        }

        // Dedupe
        writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.Deduplication, this.performDeduplication);

        if (this.PageSize > 0)
        {
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.PageSize, this.PageSize.ToString());
        }

        if (!StringUtils.IsNullOrEmpty(this.PageItemReference))
        {
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.PageItemReference, this.PageItemReference);
        }

        writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.PageDirection, this.PageDirection.ToString());
    }
 void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Mailbox);
     writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Address, this.SmtpAddress);
     writer.WriteEndElement();     // Mailbox
 }
Esempio n. 22
0
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        if (this.AssignCategories.Count > 0)
        {
            this.AssignCategories.WriteToXml(writer, XmlElementNames.AssignCategories);
        }

        if (this.CopyToFolder != null)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.CopyToFolder);
            this.CopyToFolder.WriteToXml(writer);
            writer.WriteEndElement();
        }

        if (this.Delete != false)
        {
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.Delete,
                this.Delete);
        }

        if (this.ForwardAsAttachmentToRecipients.Count > 0)
        {
            this.ForwardAsAttachmentToRecipients.WriteToXml(writer, XmlElementNames.ForwardAsAttachmentToRecipients);
        }

        if (this.ForwardToRecipients.Count > 0)
        {
            this.ForwardToRecipients.WriteToXml(writer, XmlElementNames.ForwardToRecipients);
        }

        if (this.MarkImportance.HasValue)
        {
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.MarkImportance,
                this.MarkImportance.Value);
        }

        if (this.MarkAsRead != false)
        {
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.MarkAsRead,
                this.MarkAsRead);
        }

        if (this.MoveToFolder != null)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MoveToFolder);
            this.MoveToFolder.WriteToXml(writer);
            writer.WriteEndElement();
        }

        if (this.PermanentDelete != false)
        {
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.PermanentDelete,
                this.PermanentDelete);
        }

        if (this.RedirectToRecipients.Count > 0)
        {
            this.RedirectToRecipients.WriteToXml(writer, XmlElementNames.RedirectToRecipients);
        }

        if (this.SendSMSAlertToRecipients.Count > 0)
        {
            EmailAddressCollection emailCollection = ConvertSMSRecipientsFromMobilePhoneCollectionToEmailAddressCollection(this.SendSMSAlertToRecipients);
            emailCollection.WriteToXml(writer, XmlElementNames.SendSMSAlertToRecipients);
        }

        if (this.ServerReplyWithMessage != null)
        {
            this.ServerReplyWithMessage.WriteToXml(writer, XmlElementNames.ServerReplyWithMessage);
        }

        if (this.StopProcessingRules != false)
        {
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.StopProcessingRules,
                this.StopProcessingRules);
        }
    }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (this.SearchFilter != null)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Restriction);
                this.SearchFilter.WriteToXml(writer);
                writer.WriteEndElement(); // Restriction
            }

            this.RootFolderIds.WriteToXml(writer, XmlElementNames.BaseFolderIds);
        }
Esempio n. 24
0
 /// <summary>
 /// Writes an empty OofReply to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="xmlElementName">Name of the XML element.</param>
 static void WriteEmptyReplyToXml(EwsServiceXmlWriter writer, String xmlElementName)
 {
     writer.WriteStartElement(XmlNamespace.Types, xmlElementName);
     writer.WriteEndElement();     // xmlElementName
 }
Esempio n. 25
0
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Types, this.GetXmlElementName());

            this.WriteAttributesToXml(writer);

            writer.WriteEndElement(); // this.GetXmlElementName()
        }