コード例 #1
0
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        this.ClientExtensions.Clear();
        base.ReadElementsFromXml(reader);

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions);

        if (!reader.IsEmptyElement)
        {
            // Because we don't have an element for count of returned object,
            // we have to test the element to determine if it is StartElement of return object or EndElement
            reader.Read();

            while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ClientExtension))
            {
                ClientExtension clientExtension = new ClientExtension();
                clientExtension.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.ClientExtension);
                this.ClientExtensions.Add(clientExtension);

                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.ClientExtension);
                reader.Read();
            }

            reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions);
        }

        reader.Read();
        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionRawMasterTableXml))
        {
            this.rawMasterTableXml = reader.ReadElementValue();
        }
    }
コード例 #2
0
    /// <summary>
    /// Read the response from Exchange 2013.
    /// This method assumes that the reader is currently at the Manifests element.
    /// </summary>
    /// <param name="reader">The reader.</param>
    /* private */ void ReadFromExchange2013Sp1(EwsServiceXmlReader reader)
    {
        ////<GetAppManifestsResponse ResponseClass="Success" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
        ////  <ResponseCode>NoError</ResponseCode>
        ////  <m:Apps xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
        ////    <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">       <--- reader should be at this node at the beginning of the loop
        ////      <t:Metadata>
        ////        <t:EndNodeUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&amp;ver=15&amp;clid=1033&amp;p1=15d0d766d0&amp;p2=4&amp;p3=0&amp;p4=WA&amp;p5=en-US\WA102996382&amp;Scope=2&amp;CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&amp;DeployId=EXHV-4680dom.extest.microsoft.com</t:EndNodeUrl>
        ////        <t:AppStatus>2.3</t:AppStatus>
        ////        <t:ActionUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&amp;ver=15&amp;clid=1033&amp;p1=15d0d766d0&amp;p2=4&amp;p3=0&amp;p4=WA&amp;p5=en-US\WA102996382&amp;Scope=2&amp;CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&amp;DeployId=EXHV-4680dom.extest.microsoft.com</t:ActionUrl>
        ////      </t:Metadata>
        ////      <t:Manifest>[base 64 encoded manifest]</t:Manifest>
        ////    </t:App>
        ////    <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
        ////      ....
        ////  <m:Apps>    <----- reader should be at this node at the end of the loop
        while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.App))
        {
            ClientApp clientApp = new ClientApp();
            clientApp.LoadFromXml(reader, XmlElementNames.App);

            this.Apps.Add(clientApp);
            this.Manifests.Add(clientApp.Manifest);

            reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.App);
            reader.Read();
        }
    }
コード例 #3
0
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal void LoadFromXml(EwsServiceXmlReader reader)
        {
            reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Resolution);

            reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Mailbox);
            this.mailbox.LoadFromXml(reader, XmlElementNames.Mailbox);

            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Contact))
            {
                this.contact = new Contact(this.owner.Session);

                // Contacts returned by ResolveNames should behave like Contact.Load with FirstClassPropertySet specified.
                this.contact.LoadFromXml(
                                    reader,
                                    true,                               /* clearPropertyBag */
                                    PropertySet.FirstClassProperties,
                                    false);                             /* summaryPropertiesOnly */

                reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Resolution);
            }
            else
            {
                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.Resolution);
            }
        }
コード例 #4
0
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.Rooms.Clear();
            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Rooms);

            if (!reader.IsEmptyElement)
            {
                // Because we don't have an element for count of returned object,
                // we have to test the element to determine if it is StartElement of return object or EndElement
                reader.Read();
                while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Room))
                {
                    reader.Read(); // skip the start <Room>

                    EmailAddress emailAddress = new EmailAddress();
                    emailAddress.LoadFromXml(reader, XmlElementNames.RoomId);
                    this.Rooms.Add(emailAddress);

                    reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Room);
                    reader.Read();
                }

                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.Rooms);
            }
        }
コード例 #5
0
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        this.Rooms.Clear();
        base.ReadElementsFromXml(reader);

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Rooms);

        if (!reader.IsEmptyElement)
        {
            // Because we don't have an element for count of returned object,
            // we have to test the element to determine if it is StartElement of return object or EndElement
            reader.Read();
            while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Room))
            {
                reader.Read();     // skip the start <Room>

                EmailAddress emailAddress = new EmailAddress();
                emailAddress.LoadFromXml(reader, XmlElementNames.RoomId);
                this.Rooms.Add(emailAddress);

                reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Room);
                reader.Read();
            }

            reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.Rooms);
        }
    }
コード例 #6
0
ファイル: UnifiedGroupsSet.cs プロジェクト: liaozhigang/ews
    void LoadFromXml(EwsServiceXmlReader reader, String xmlElementName)
    {
        reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet);

        do
        {
            reader.Read();
            switch (reader.LocalName)
            {
            case XmlElementNames.FilterType:
                this.FilterType = (UnifiedGroupsFilterType)Enum.Parse(typeof(UnifiedGroupsFilterType), reader.ReadElementValue(), false);
                break;

            case XmlElementNames.TotalGroups:
                this.TotalGroups = reader.ReadElementValue <int>();
                break;

            case XmlElementNames.GroupsTag:
                reader.Read();
                while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup))
                {
                    UnifiedGroup unifiedGroup = new UnifiedGroup();
                    unifiedGroup.LoadFromXml(reader, XmlElementNames.UnifiedGroup);
                    this.unifiedGroups.Add(unifiedGroup);
                }

                // Skip end element.
                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsTag);
                reader.Read();
                break;

            default:
                break;
            }
        }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet));

        // Skip end element
        reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet);
        reader.Read();
    }
コード例 #7
0
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        this.Manifests.Clear();
        base.ReadElementsFromXml(reader);

        reader.Read(XmlNodeType.Element);

        // We can have a response from Exchange 2013 (first time this API was introduced)
        // or the newer response, starting in Exchange 2013 SP1, (X-EWS-TargetVersion: 2.5 or above)
        bool exchange2013Response;

        if (XmlElementNames.Manifests.Equals(reader.LocalName))
        {
            exchange2013Response = true;
        }
        else if (XmlElementNames.Apps.Equals(reader.LocalName))
        {
            exchange2013Response = false;
        }
        else
        {
            throw new ServiceXmlDeserializationException(
                      string.Format(
                          Strings.UnexpectedElement,
                          EwsUtilities.GetNamespacePrefix(XmlNamespace.Messages),
                          XmlElementNames.Manifests,
                          XmlNodeType.Element,
                          reader.LocalName,
                          reader.NodeType));
        }

        if (!reader.IsEmptyElement)
        {
            // Because we don't have an element for count of returned object,
            // we have to test the element to determine if it is StartElement of return object or EndElement
            reader.Read();

            if (exchange2013Response)
            {
                this.ReadFromExchange2013(reader);
            }
            else
            {
                this.ReadFromExchange2013Sp1(reader);
            }
        }

        reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, exchange2013Response ? XmlElementNames.Manifests : XmlElementNames.Apps);
    }
コード例 #8
0
ファイル: UnifiedGroup.cs プロジェクト: saurabh-mhaisekar/ews
    void LoadFromXml(EwsServiceXmlReader reader, String xmlElementName)
    {
        reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup);
        do
        {
            reader.Read();
            switch (reader.LocalName)
            {
            case XmlElementNames.SmtpAddress:
                this.SmtpAddress = reader.ReadElementValue <String>();
                break;

            case XmlElementNames.LegacyDN:
                this.LegacyDN = reader.ReadElementValue <String>();
                break;

            case XmlElementNames.MailboxGuid:
                this.MailboxGuid = reader.ReadElementValue <String>();
                break;

            case XmlElementNames.DisplayName:
                this.DisplayName = reader.ReadElementValue <String>();
                break;

            case XmlElementNames.IsFavorite:
                this.IsFavorite = reader.ReadElementValue <bool>();
                break;

            case XmlElementNames.LastVisitedTimeUtc:
                this.LastVisitedTimeUtc = reader.ReadElementValue <String>();
                break;

            case XmlElementNames.AccessType:
                this.AccessType = (UnifiedGroupAccessType)Enum.Parse(typeof(UnifiedGroupAccessType), reader.ReadElementValue <String>(), false);
                break;

            case XmlElementNames.ExternalDirectoryObjectId:
                this.ExternalDirectoryObjectId = reader.ReadElementValue <String>();
                break;

            default:
                break;
            }
        }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup));

        // Skip end element
        reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.UnifiedGroup);
        reader.Read();
    }
コード例 #9
0
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            responseCollection = new ServiceResponseCollection <MailTipsResponseMessage>();
            base.ReadElementsFromXml(reader);
            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages);

            if (!reader.IsEmptyElement)
            {
                // Because we don't have count of returned objects
                // test the element to determine if it is return object or EndElement
                reader.Read();
                while (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MailTipsResponseMessageType))
                {
                    MailTipsResponseMessage mrm = new MailTipsResponseMessage();
                    mrm.LoadFromXml(reader, XmlElementNames.MailTipsResponseMessageType);
                    this.responseCollection.Add(mrm);
                    reader.Read();
                }
                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages);
            }
        }
コード例 #10
0
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            responseCollection = new ServiceResponseCollection<MailTipsResponseMessage>();
            base.ReadElementsFromXml(reader);
            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages);

            if (!reader.IsEmptyElement)
            {
                // Because we don't have count of returned objects
                // test the element to determine if it is return object or EndElement
                reader.Read();
                while (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MailTipsResponseMessageType))
                {
                    MailTipsResponseMessage mrm = new MailTipsResponseMessage();
                    mrm.LoadFromXml(reader, XmlElementNames.MailTipsResponseMessageType);
                    this.responseCollection.Add(mrm);
                    reader.Read();
                }
                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages);
            }
        }
コード例 #11
0
         /// <summary>
         /// Read Conversations from XML.
         /// </summary>
         /// <param name="reader">The reader.</param>
         internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
         {
             this.groupsSets.Clear();
             base.ReadElementsFromXml(reader);

             reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.GroupsSets);

             if (!reader.IsEmptyElement)
             {
                 reader.Read();
                 while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet))
                 {
                     UnifiedGroupsSet unifiedGroupsSet = new UnifiedGroupsSet();
                     unifiedGroupsSet.LoadFromXml(reader, XmlElementNames.UnifiedGroupsSet);
                     this.groupsSets.Add(unifiedGroupsSet);
                 }

                 // Skip end element GroupsSets
                 reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsSets);
                 reader.Read();
             }
         }
コード例 #12
0
        /// <summary>
        /// Read Conversations from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.groupsSets.Clear();
            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.GroupsSets);

            if (!reader.IsEmptyElement)
            {
                reader.Read();
                while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet))
                {
                    UnifiedGroupsSet unifiedGroupsSet = new UnifiedGroupsSet();
                    unifiedGroupsSet.LoadFromXml(reader, XmlElementNames.UnifiedGroupsSet);
                    this.groupsSets.Add(unifiedGroupsSet);
                }

                // Skip end element GroupsSets
                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsSets);
                reader.Read();
            }
        }
コード例 #13
0
        /// <summary>
        /// Read Conversations from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="xmlElementName">The xml element to read.</param>
        internal override void LoadFromXml(EwsServiceXmlReader reader, string xmlElementName)
        {
            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup);
            do
            {
                reader.Read();
                switch (reader.LocalName)
                {
                    case XmlElementNames.SmtpAddress:
                        this.SmtpAddress = reader.ReadElementValue();
                        break;
                    case XmlElementNames.LegacyDN:
                        this.LegacyDN = reader.ReadElementValue();
                        break;
                    case XmlElementNames.MailboxGuid:
                        this.MailboxGuid = reader.ReadElementValue();
                        break;
                    case XmlElementNames.DisplayName:
                        this.DisplayName = reader.ReadElementValue();
                        break;
                    case XmlElementNames.IsFavorite:
                        this.IsFavorite = reader.ReadElementValue<bool>();
                        break;
                    case XmlElementNames.LastVisitedTimeUtc:
                        this.LastVisitedTimeUtc = reader.ReadElementValue();
                        break;
                    case XmlElementNames.AccessType:
                        this.AccessType = (UnifiedGroupAccessType)Enum.Parse(typeof(UnifiedGroupAccessType), reader.ReadElementValue(), false);
                        break;
                    case XmlElementNames.ExternalDirectoryObjectId:
                        this.ExternalDirectoryObjectId = reader.ReadElementValue();
                        break;
                    default:
                        break;
                }
            }
            while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup));

            // Skip end element
            reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.UnifiedGroup);
            reader.Read(); 
        }
コード例 #14
0
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.ClientExtensions.Clear();
            base.ReadElementsFromXml(reader);
            
            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions);

            if (!reader.IsEmptyElement)
            {
                // Because we don't have an element for count of returned object,
                // we have to test the element to determine if it is StartElement of return object or EndElement
                reader.Read();

                while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ClientExtension))
                {
                    ClientExtension clientExtension = new ClientExtension();
                    clientExtension.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.ClientExtension);
                    this.ClientExtensions.Add(clientExtension);

                    reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.ClientExtension);
                    reader.Read();
                }

                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions);
            }

            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionRawMasterTableXml))
            {
                this.rawMasterTableXml = reader.ReadElementValue();
            }
        }
コード例 #15
0
         /// <summary>
         /// Read Conversations from XML.
         /// </summary>
         /// <param name="reader">The reader.</param>
         /// <param name="xmlElementName">The name of the xml element</param>
         internal override void LoadFromXml(EwsServiceXmlReader reader, string xmlElementName)
         {
             reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet);

             do
             {
                 reader.Read();
                 switch (reader.LocalName)
                 {
                     case XmlElementNames.FilterType:
                         this.FilterType = (UnifiedGroupsFilterType)Enum.Parse(typeof(UnifiedGroupsFilterType), reader.ReadElementValue(), false);
                         break;
                     case XmlElementNames.TotalGroups:
                         this.TotalGroups = reader.ReadElementValue<int>();
                         break;                     
                     case XmlElementNames.GroupsTag:
                         reader.Read();
                         while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup))
                         {
                             UnifiedGroup unifiedGroup = new UnifiedGroup();
                             unifiedGroup.LoadFromXml(reader, XmlElementNames.UnifiedGroup);
                             this.unifiedGroups.Add(unifiedGroup);
                         }
                         
                         // Skip end element.
                         reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsTag);
                         reader.Read();
                         break;
                     default:
                         break;
                 }
             }
             while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet));

             // Skip end element
             reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet);
             reader.Read();
         }
コード例 #16
0
        /// <summary>
        /// Read the response from Exchange 2013.
        /// This method assumes that the reader is currently at the Manifests element.
        /// </summary>
        /// <param name="reader">The reader.</param>
        private void ReadFromExchange2013Sp1(EwsServiceXmlReader reader)
        {
            ////<GetAppManifestsResponse ResponseClass="Success" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
            ////  <ResponseCode>NoError</ResponseCode>
            ////  <m:Apps xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
            ////    <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">       <--- reader should be at this node at the beginning of the loop
            ////      <t:Metadata>
            ////        <t:EndNodeUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&amp;ver=15&amp;clid=1033&amp;p1=15d0d766d0&amp;p2=4&amp;p3=0&amp;p4=WA&amp;p5=en-US\WA102996382&amp;Scope=2&amp;CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&amp;DeployId=EXHV-4680dom.extest.microsoft.com</t:EndNodeUrl>
            ////        <t:AppStatus>2.3</t:AppStatus>
            ////        <t:ActionUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&amp;ver=15&amp;clid=1033&amp;p1=15d0d766d0&amp;p2=4&amp;p3=0&amp;p4=WA&amp;p5=en-US\WA102996382&amp;Scope=2&amp;CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&amp;DeployId=EXHV-4680dom.extest.microsoft.com</t:ActionUrl>
            ////      </t:Metadata>
            ////      <t:Manifest>[base 64 encoded manifest]</t:Manifest>
            ////    </t:App>
            ////    <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            ////      ....
            ////  <m:Apps>    <----- reader should be at this node at the end of the loop
            while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.App))
            {
                ClientApp clientApp = new ClientApp();
                clientApp.LoadFromXml(reader, XmlElementNames.App);

                this.Apps.Add(clientApp);
                this.Manifests.Add(clientApp.Manifest);

                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.App);
                reader.Read();
            }
        }
コード例 #17
0
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.Manifests.Clear();
            base.ReadElementsFromXml(reader);

            reader.Read(XmlNodeType.Element);

            // We can have a response from Exchange 2013 (first time this API was introduced)
            // or the newer response, starting in Exchange 2013 SP1, (X-EWS-TargetVersion: 2.5 or above) 
            bool exchange2013Response;
            if (XmlElementNames.Manifests.Equals(reader.LocalName))
            {
                exchange2013Response = true;
            }
            else if (XmlElementNames.Apps.Equals(reader.LocalName))
            {
                exchange2013Response = false;
            }
            else
            {
                throw new ServiceXmlDeserializationException(
                    string.Format(
                        Strings.UnexpectedElement,
                        EwsUtilities.GetNamespacePrefix(XmlNamespace.Messages),
                        XmlElementNames.Manifests,
                        XmlNodeType.Element,
                        reader.LocalName,
                        reader.NodeType));
            }

            if (!reader.IsEmptyElement)
            {
                // Because we don't have an element for count of returned object,
                // we have to test the element to determine if it is StartElement of return object or EndElement
                reader.Read();

                if (exchange2013Response)
                {
                    this.ReadFromExchange2013(reader);
                }
                else
                {
                    this.ReadFromExchange2013Sp1(reader);
                }
            }

            reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, exchange2013Response ? XmlElementNames.Manifests : XmlElementNames.Apps);
        }