void WriteAttributesToXml(EwsServiceXmlWriter writer)
    {
        writer.WriteAttributeValue(XmlAttributeNames.SetClientExtensionActionId, this.setClientExtensionActionId);

        if (!StringUtils.IsNullOrEmpty(this.extensionId))
        {
            writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionId, this.extensionId);
        }
    }
        /// <summary>
        /// Writes the autodiscover SOAP request.
        /// </summary>
        /// <param name="requestUrl">Request URL.</param>
        /// <param name="writer">The writer.</param>
        internal void WriteSoapRequest(
            Uri requestUrl,
            EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Soap, XmlElementNames.SOAPEnvelopeElementName);
            writer.WriteAttributeValue("xmlns", EwsUtilities.AutodiscoverSoapNamespacePrefix, EwsUtilities.AutodiscoverSoapNamespace);
            writer.WriteAttributeValue("xmlns", EwsUtilities.WSAddressingNamespacePrefix, EwsUtilities.WSAddressingNamespace);
            writer.WriteAttributeValue("xmlns", EwsUtilities.EwsXmlSchemaInstanceNamespacePrefix, EwsUtilities.EwsXmlSchemaInstanceNamespace);
            if (writer.RequireWSSecurityUtilityNamespace)
            {
                writer.WriteAttributeValue("xmlns", EwsUtilities.WSSecurityUtilityNamespacePrefix, EwsUtilities.WSSecurityUtilityNamespace);
            }

            writer.WriteStartElement(XmlNamespace.Soap, XmlElementNames.SOAPHeaderElementName);

            if (this.Service.Credentials != null)
            {
                this.Service.Credentials.EmitExtraSoapHeaderNamespaceAliases(writer.InternalWriter);
            }

            writer.WriteElementValue(
                XmlNamespace.Autodiscover,
                XmlElementNames.RequestedServerVersion,
                this.Service.RequestedServerVersion.ToString());

            writer.WriteElementValue(
                XmlNamespace.WSAddressing,
                XmlElementNames.Action,
                this.GetWsAddressingActionName());

            writer.WriteElementValue(
                XmlNamespace.WSAddressing,
                XmlElementNames.To,
                requestUrl.AbsoluteUri);

            this.WriteExtraCustomSoapHeadersToXml(writer);

            if (this.Service.Credentials != null)
            {
                this.Service.Credentials.SerializeWSSecurityHeaders(writer.InternalWriter);
            }

            this.Service.DoOnSerializeCustomSoapHeaders(writer.InternalWriter);

            writer.WriteEndElement(); // soap:Header

            writer.WriteStartElement(XmlNamespace.Soap, XmlElementNames.SOAPBodyElementName);

            this.WriteBodyToXml(writer);

            writer.WriteEndElement(); // soap:Body
            writer.WriteEndElement(); // soap:Envelope
            writer.Flush();
        }
        void WriteAttributesToXml(EwsServiceXmlWriter writer)
        {
            if (this.Traversal.HasValue)
            {
                writer.WriteAttributeValue(XmlAttributeNames.Traversal, this.Traversal);
            }

            if (this.ViewFilter.HasValue)
            {
                writer.WriteAttributeValue(XmlAttributeNames.ViewFilter, this.ViewFilter);
            }
        }
        /// <summary>
        /// Writes the attributes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
        {
            base.WriteAttributesToXml(writer);

            writer.WriteAttributeValue(XmlAttributeNames.Id, this.UniqueId);
            writer.WriteAttributeValue(XmlAttributeNames.Mailbox, this.Mailbox);

            // this is optional attribute will default false so we will write
            // it only if it is true
            if (this.IsArchive)
            {
                writer.WriteAttributeValue(XmlAttributeNames.IsArchive, true);
            }
        }
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(
         "xmlns",
         EwsUtilities.AutodiscoverSoapNamespacePrefix,
         EwsUtilities.AutodiscoverSoapNamespace);
 }
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     if (this.ViewFilter.HasValue)
     {
         writer.WriteAttributeValue(XmlAttributeNames.ViewFilter, this.ViewFilter);
     }
 }
Beispiel #7
0
    /// <summary>
    /// Writes a dictionary object (key or value) to Xml.
    /// </summary>
    /// <param name="writer">The writer.</param>
    /// <param name="xmlElementName">The Xml element name.</param>
    /// <param name="dictionaryObject">The object to write.</param>
    /* private */ void WriteObjectToXml(
        EwsServiceXmlWriter writer,
        String xmlElementName,
        object dictionaryObject)
    {
        EwsUtilities.Assert(
            writer != null,
            "UserConfigurationDictionary.WriteObjectToXml",
            "writer is null");
        EwsUtilities.Assert(
            xmlElementName != null,
            "UserConfigurationDictionary.WriteObjectToXml",
            "xmlElementName is null");

        writer.WriteStartElement(XmlNamespace.Types, xmlElementName);

        if (dictionaryObject == null)
        {
            EwsUtilities.Assert(
                xmlElementName != XmlElementNames.DictionaryKey,
                "UserConfigurationDictionary.WriteObjectToXml",
                "Key is null");

            writer.WriteAttributeValue(
                EwsUtilities.EwsXmlSchemaInstanceNamespacePrefix,
                XmlAttributeNames.Nil,
                EwsUtilities.XSTrue);
        }
        else
        {
            this.WriteObjectValueToXml(writer, dictionaryObject);
        }

        writer.WriteEndElement();
    }
Beispiel #8
0
    /// <summary>
    /// Writes to Xml.
    /// </summary>
    /// <param name="writer">The writer.</param>
    /// <param name="xmlNamespace">The XML namespace.</param>
    /// <param name="name">The user configuration name.</param>
    /// <param name="parentFolderId">The Id of the folder containing the user configuration.</param>
    static void WriteUserConfigurationNameToXml(
        EwsServiceXmlWriter writer,
        XmlNamespace xmlNamespace,
        String name,
        FolderId parentFolderId)
    {
        EwsUtilities.Assert(
            writer != null,
            "UserConfiguration.WriteUserConfigurationNameToXml",
            "writer is null");
        EwsUtilities.Assert(
            name != null,
            "UserConfiguration.WriteUserConfigurationNameToXml",
            "name is null");
        EwsUtilities.Assert(
            parentFolderId != null,
            "UserConfiguration.WriteUserConfigurationNameToXml",
            "parentFolderId is null");

        writer.WriteStartElement(xmlNamespace, XmlElementNames.UserConfigurationName);

        writer.WriteAttributeValue(XmlAttributeNames.Name, name);

        parentFolderId.WriteToXml(writer);

        writer.WriteEndElement();
    }
Beispiel #9
0
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     if (this.ViewFilter.HasValue)
     {
         writer.WriteAttributeValue(XmlAttributeNames.ViewFilter, this.ViewFilter);
     }
 }
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        if (null != this.requestedExtensionIds && this.requestedExtensionIds.Count > 0)
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionRequestedIds);
            requestedExtensionIds.WriteElementsToXml(writer);
            writer.WriteEndElement();
        }

        if (this.isUserScope)
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionUserRequest);

            writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionUserIdentity, this.userId);

            if (shouldReturnEnabledOnly)
            {
                writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionEnabledOnly, this.shouldReturnEnabledOnly);
            }

            if (null != this.userEnabledExtensionIds && this.userEnabledExtensionIds.Count > 0)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ClientExtensionUserEnabled);
                userEnabledExtensionIds.WriteElementsToXml(writer);
                writer.WriteEndElement();
            }

            if (null != this.userDisabledExtensionIds && this.userDisabledExtensionIds.Count > 0)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ClientExtensionUserDisabled);
                userDisabledExtensionIds.WriteElementsToXml(writer);
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }

        if (isDebug)
        {
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ClientExtensionIsDebug, isDebug);
        }
    }
    void WriteElementsToXml(EwsServiceXmlWriter writer)
    {
        writer.WriteAttributeValue(XmlAttributeNames.DestinationFormat, this.DestinationFormat);

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

        for (AlternateIdBase alternateId in this.Ids)
        {
            alternateId.WriteToXml(writer);
        }

        writer.WriteEndElement();     // SourceIds
    }
Beispiel #12
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
    }
    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());
    }
 /// <summary>
 /// Writes the member key attribute to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     // if this.key is null or empty, writer skips the attribute
     writer.WriteAttributeValue(XmlAttributeNames.Key, this.key);
 }
 /// <summary>
 /// Writes attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.BodyType, this.BodyType);
 }
Beispiel #16
0
 void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.Id, this.id);
 }
    void WriteAttributesToXml(EwsServiceXmlWriter writer)
    {
        base.WriteAttributesToXml(writer);

        writer.WriteAttributeValue(XmlAttributeNames.FolderId, this.FolderId);
    }
Beispiel #18
0
 void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.HeaderName, this.Name);
 }
 /// <summary>
 /// Writes attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.OccurrenceId, this.UniqueId);
     writer.WriteAttributeValue(XmlAttributeNames.ChangeKey, this.ChangeKey);
 }
Beispiel #20
0
 void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.IsJunk, this.IsJunk);
     writer.WriteAttributeValue(XmlAttributeNames.MoveItem, this.MoveItem);
 }
        /// <summary>
        /// Writes the attributes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
        {
            base.WriteAttributesToXml(writer);

            writer.WriteAttributeValue(XmlAttributeNames.FolderId, this.FolderId);
        }
 void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     base.WriteAttributesToXml(writer);
     writer.WriteAttributeValue(XmlAttributeNames.FieldIndex, this.Key);
 }
Beispiel #23
0
    void WriteAttributesToXml(EwsServiceXmlWriter writer)
    {
        base.WriteAttributesToXml(writer);

        writer.WriteAttributeValue(XmlAttributeNames.IncludePermissions, this.IncludePermissions);
    }
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal virtual void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.Format, this.Format);
 }
 /// <summary>
 /// Writes attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.OccurrenceId, this.UniqueId);
     writer.WriteAttributeValue(XmlAttributeNames.ChangeKey, this.ChangeKey);
 }
 void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionType, this.Type);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionScope, this.Scope);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionMarketplaceAssetID, this.MarketplaceAssetID);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionMarketplaceContentMarket, this.MarketplaceContentMarket);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionAppStatus, this.AppStatus);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionEtoken, this.Etoken);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionInstalledDateTime, this.InstalledDateTime);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionIsAvailable, this.IsAvailable);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionIsMandatory, this.IsMandatory);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionIsEnabledByDefault, this.IsEnabledByDefault);
     writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionProvidedTo, this.ProvidedTo);
 }
Beispiel #27
0
        /// <summary>
        /// Writes the attributes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
        {
            base.WriteAttributesToXml(writer);

            writer.WriteAttributeValue(XmlAttributeNames.Id, this.UniqueId);
            writer.WriteAttributeValue(XmlAttributeNames.Mailbox, this.Mailbox);

            // this is optional attribute will default false so we will write
            // it only if it is true
            if (this.IsArchive)
            {
                writer.WriteAttributeValue(XmlAttributeNames.IsArchive, true);
            }
        }
 /// <summary>
 /// Writes the member key attribute to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     // if this.key is null or empty, writer skips the attribute
     writer.WriteAttributeValue(XmlAttributeNames.Key, this.key);
 }
Beispiel #29
0
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.Traversal, this.Traversal);
 }
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal virtual void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.Format, this.Format);
 }
 /// <summary>
 /// Writes attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.BodyType, this.BodyType);
 }
 /// <summary>
 /// Writes the attributes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteAttributesToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteAttributeValue(XmlAttributeNames.Traversal, this.Traversal);
 }