/// <remarks/>
 public System.IAsyncResult BeginGetListItemChangesSinceToken(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetListItemChangesSinceToken", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             changeToken,
             contains}, callback, asyncState);
 }
 /// <remarks/>
 public void GetListItemChangesSinceTokenAsync(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains)
 {
     this.GetListItemChangesSinceTokenAsync(listName, viewName, query, viewFields, rowLimit, queryOptions, changeToken, contains, null);
 }
        public void MSLISTSWS_S03_TC56_GetListItems_WithoutPaging()
        {
            // Create a list.
            string listId = TestSuiteHelper.CreateList();

            // Insert 10 items.
            List<string> addedItems = TestSuiteHelper.AddListItems(listId, 10);

            // Sort the list to make sure order by Ascending.
            addedItems = addedItems.OrderBy<string, int>(key => Convert.ToInt32(key)).ToList();

            // Create Query element to make the z:row ordered by OWS_ID Ascending.
            GetListItemsQuery query = new GetListItemsQuery();
            query.Query = new CamlQueryRoot();
            query.Query.OrderBy = new OrderByDefinition();
            query.Query.OrderBy.FieldRef = new FieldRefDefinitionOrderBy[1];
            query.Query.OrderBy.FieldRef[0] = new FieldRefDefinitionOrderBy();
            query.Query.OrderBy.FieldRef[0].Name = AdapterHelper.FieldIDName;
            query.Query.OrderBy.FieldRef[0].Ascending = "TRUE";

            // Call the GetListItems excluding the paging.
            GetListItemsResponseGetListItemsResult result = null;
            result = this.listswsAdapter.GetListItems(
                                    listId,
                                    null,
                                    query,
                                    null,
                                    null,
                                    null,
                                    null);

            string columnNameId = AdapterHelper.PrefixOws + AdapterHelper.FieldIDName;
            DataTable data = AdapterHelper.ExtractData(result.listitems.data.Any);

            // If the returned z:row count number equals to the all item number
            // and the returned first z:row ows_ID equals the first addedItems element, 
            // it will be sure that it starts from the first index.
            bool isStartFirstIndexExcludePaging = data.Rows.Count == addedItems.Count && Convert.ToString(data.Rows[0][columnNameId]) == addedItems[0];
            Site.Assert.IsTrue(
                            isStartFirstIndexExcludePaging,
                            "When paging element is not specified, the list items returned start from the beginning of the list.");

            // Call GetListItems with empty paging
            CamlQueryOptions options = new CamlQueryOptions();
            options.QueryOptions = new CamlQueryOptionsQueryOptions();
            options.QueryOptions.Paging = new CamlQueryOptionsQueryOptionsPaging();
            result = this.listswsAdapter.GetListItems(
                                    listId,
                                    null,
                                    query,
                                    null,
                                    null,
                                    options,
                                    null);

            // If the returned z:row count number equals to the all item number
            // and the returned first z:row ows_ID equals the first addedItems element, 
            // it will be sure that it starts from the first index.
            data = AdapterHelper.ExtractData(result.listitems.data.Any);
            bool isStartFirstIndexEmptyPaging = data.Rows.Count == addedItems.Count && Convert.ToString(data.Rows[0][columnNameId]) == addedItems[0];
            Site.Assert.IsTrue(
                            isStartFirstIndexEmptyPaging,
                            "When paging element is empty, the list items returned start from the beginning of the list.");

            Site.CaptureRequirementIfIsTrue(
                isStartFirstIndexEmptyPaging && isStartFirstIndexExcludePaging,
                1251,
                @"[Paging]If this element[Paging] is left empty or excluded, the list items returned start from the beginning of the list.");
        }
 public GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult GetListItemChangesSinceToken(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains)
 {
     object[] results = this.Invoke("GetListItemChangesSinceToken", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             changeToken,
             contains});
     return ((GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult)(results[0]));
 }
        /// <summary>
        /// Verify the message syntax of GetListItems operation when the response is received 
        /// successfully.
        /// </summary>
        /// <param name="getListItemResult">The result of the operation.</param>
        /// <param name="queryOptions">Specifies various options for modifying the query.</param>
        /// <param name="viewFields">Specifies which fields of the list item will be returned.</param>
        private void VerifyGetListItemsOperation(GetListItemsResponseGetListItemsResult getListItemResult, CamlQueryOptions queryOptions, CamlViewFields viewFields)
        {
            // Verify R1910
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1910,
                @"[The schema of GetListItems is defined as:]"
                + @"<wsdl:operation name=""GetListItems"">"
                + @"    <wsdl:input message=""GetListItemsSoapIn"" />"
                + @"    <wsdl:output message=""GetListItemsSoapOut"" />"
                + @"</wsdl:operation>");

            // Verify R723
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                723,
                @"[In GetListItems operation] [If the protocol client sends a GetListItemsSoapIn "
                + "request message] the protocol server responds with a GetListItemsSoapOut "
                + "response message.");

            // Verify R1918
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1918,
                @"[GetListItemsSoapOut]The SOAP Body contains a GetListItemsResponse "
                + "element.");

            // Verify R1935
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1935,
                @"[The schema of GetListItemsResponse is defined as:] "
                + @"<s:element name=""GetListItemsResponse"">"
                + @"  <s:complexType mixed=""true"">"
                + @"    <s:sequence>"
                + @"      <s:element minOccurs=""0"" maxOccurs=""1"" name=""GetListItemsResult"">"
                + @"        <s:complexType>"
                + @"          <s:sequence>"
                + @"            <s:element name=""listitems"" >"
                + @"              <s:complexType mixed=""true"" >"
                + @"                <s:sequence>"
                + @"                  <s:any />"
                + @"                </s:sequence>"
                + @"              </s:complexType>"
                + @"            </s:element>"
                + @"          </s:sequence>"
                + @"        </s:complexType>"
                + @"      </s:element>"
                + @"    </s:sequence>"
                + @"  </s:complexType>"
                + @"</s:element>");

            // Verify R1936
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1936,
                @"[GetListItemsResponse]GetListItemsResult: This protocol server response included in "
                + "the listitems element is modeled on the Microsoft ADO 2.6 Persistence format "
                + "[MS-PRSTFR], excluding the <s:schema> element.");

            // Verify R2330
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                2330,
                @"[In GetListitems operation] [In GetListitemsResponse element] [In GetListItemsResult "
                + "element]The listitems element includes attributes describing the namespaces "
                + "for the ADO 2.6 Persistence format.");

            // Verify R2331
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                2331,
                @"[In GetListitems operation] [In GetListitemsResponse element] [In GetListItemsResult "
                + "element] [The listitems element] contains an inner element named rs:data, which is "
                + "of type DataDefinition.");

            // Verify R1938
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1938,
                @"[GetListItemsResponse]Note that set of fields returned by the method is restricted "
                + "by the viewField or viewName parameter.");

            // Verify R1940
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1940,
                @"[GetListItemsResponse]The listitems element contains attributes that define the "
                + "namespaces.");

            // Verify R1941
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1941,
                @"[GetListItemsResponse]Inside of this element[listitems] is the <rs:data> element, which "
                + "specifies how many rows of data are being returned, where a row of data "
                + "corresponds to a list item, and the paging token (if there are more rows in "
                + "the view than were returned).");

            // Verify the requirements of the EnumViewAttributes simple type.
            if (queryOptions != null)
            {
                if (getListItemResult.listitems.data.Any != null)
                {
                    DataTable data = AdapterHelper.ExtractData(getListItemResult.listitems.data.Any);
                    string author = data.Columns.Contains("ows_Author") ? Convert.ToString(data.Rows[0]["ows_Author"]) : null;
                    this.VerifyCamlQueryOptions(queryOptions, viewFields, author);
                }

                if (queryOptions.QueryOptions != null)
                {
                    if (queryOptions.QueryOptions.ViewAttributes != null)
                    {
                        if (queryOptions.QueryOptions.ViewAttributes.ScopeSpecified)
                        {
                            this.VerifyEnumViewAttributes();
                        }
                    }
                }
            }
        }
        public void MSOUTSPS_S02_TC42_GetListItemChangesSinceToken_OptimizeLookups()
        {
            // Add a list and add 3 list items.
            string listId = this.AddListToSUT(TemplateType.Generic_List);
            List<string> addedListitemIds = this.AddItemsToList(listId, 3);

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                // Call GetListItemChangesSinceToken operation without "OptimizeLookups"
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                            listId,
                                            null,
                                            null,
                                            null,
                                            null,
                                            null,
                                            null,
                                            null);

                this.VerifyContainZrowDataStructure(listItemChangesRes);
                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);
                this.Site.Assert.AreEqual<int>(
                                3,
                                zrowItems.Count(),
                                "The zrow items should equal to the number of added list items[3].");

                // Verify all added list item ids are in the zrow items' array.
                foreach (string addedListItemIdItem in addedListitemIds)
                {
                    bool isListItemIdIncludedInZrowItem = this.VerifyContainExpectedListItemById(addedListItemIdItem, zrowItems);
                    this.Site.Assert.IsTrue(
                                        isListItemIdIncludedInZrowItem,
                                        "The list item id[{0}] should be included in zrow items' array.",
                                        addedListItemIdItem);
                }

                // Setting "OptimizeLookups = true"
                CamlQueryOptions queryOptions = new CamlQueryOptions();
                queryOptions.QueryOptions = new CamlQueryOptionsQueryOptions();
                queryOptions.QueryOptions.OptimizeLookups = bool.TrueString;

                // Call GetListItemChangesSinceToken operation with the "OptimizeLookups = true"
                listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                            listId,
                                            null,
                                            null,
                                            null,
                                            null,
                                            queryOptions,
                                            null,
                                            null);

                this.VerifyContainZrowDataStructure(listItemChangesRes);
                XmlNode[] zrowItemsWithOptimizeLookups = this.GetZrowItems(listItemChangesRes.listitems.data.Any);
                this.Site.Assert.AreEqual<int>(
                            3,
                            zrowItemsWithOptimizeLookups.Count(),
                            "The zrow items should equal to the number of added list items[3].");

                // Verify all added list item ids are in the zrow items' array.
                foreach (string addedListItemIdItem in addedListitemIds)
                {
                    bool isListItemIdIncludedInZrowItem = this.VerifyContainExpectedListItemById(addedListItemIdItem, zrowItems);
                    this.Site.Assert.IsTrue(
                                        isListItemIdIncludedInZrowItem,
                                        "The list item id[{0}] should be included in zrow items' array.",
                                        addedListItemIdItem);
                }

                // If pass upon verification, that means OptimizeLookups does not change the contents of a successful protocol server response. 
                // Verify MS-OUTSPS requirement: MS-OUTSPS_R1184
                this.Site.CaptureRequirement(
                                1184,
                                @"[In GetListItemChangesSinceToken]Including this element[queryOptions.OptimizeLookups]MUST NOT change the contents of a successful protocol server response.");
            }
        }
 /// <remarks/>
 public void GetListItemsAsync(string listName, string viewName, GetListItemsQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string webID, object userState)
 {
     if ((this.GetListItemsOperationCompleted == null))
     {
         this.GetListItemsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetListItemsOperationCompleted);
     }
     this.InvokeAsync("GetListItems", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             webID}, this.GetListItemsOperationCompleted, userState);
 }
        /// <summary>
        /// Verify the message syntax of GetListItemChangesSinceToken operation when the response 
        /// is received successfully.
        /// </summary>
        /// <param name="getListItemChangesSinceTokenResult">The result of the operation</param>
        /// <param name="queryOptions">Specifies various options for modifying the query</param>
        /// <param name="viewFields">Specifies which fields of the list item will be returned</param>
        private void VerifyGetListItemChangesSinceTokenOperation(
            GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult getListItemChangesSinceTokenResult,
            CamlQueryOptions queryOptions,
            CamlViewFields viewFields)
        {
            // Ensure the SOAP result is de-serialized successfully.
            Site.Assume.IsNotNull(getListItemChangesSinceTokenResult, "The result of GetListItemChangesSinceToken operation must not be null.");

            // Verify R1876
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1876,
                @"[The schema of GetListItemChangesSinceToken is defined as:]"
                + @"<wsdl:operation name=""GetListItemChangesSinceToken"">"
                + @"    <wsdl:input message=""GetListItemChangesSinceTokenSoapIn"" />"
                + @"    <wsdl:output message=""GetListItemChangesSinceTokenSoapOut"" />"
                + @"</wsdl:operation>");

            // Verify R654
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                654,
                @"[In GetListItemChangesSinceToken operation] [If the protocol client sends a "
                + "GetListItemChangesSinceTokenSoapIn request message] the protocol server "
                + "responds with a GetListItemChangesSinceTokenSoapOut response message.");

            // Verify R1882
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1882,
                @"[GetListItemChangesSinceTokenSoapOut]The SOAP Body contains a "
                + "GetListItemChangesSinceTokenResponse element.");

            // Verify R1897
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1897,
                @"[The schema of GetListItemChangesSinceTokenResponse is defined as:] <s:element name=""GetListItemChangesSinceTokenResponse"">
              <s:complexType>
                <s:sequence>
                    <s:element minOccurs=""0"" maxOccurs=""1"" name=""GetListItemChangesSinceTokenResult"">
                     <s:complexType mixed=""true"">
                      <s:sequence>
                        <s:element name=""listitems"" >
                          <s:complexType>
                            <s:sequence>
                              <s:element name=""Changes"" >
                                <s:complexType>
                                  <s:sequence>
                                    <s:element name=""List"" type=""tns:ListDefinitionSchema""  
                                               minOccurs=""0"" />
                                    <s:element name=""Id"" type=""tns:ListItemChangeDefinition"" minOccurs=""0""/>                      
                                  </s:sequence>
                                  <s:attribute name=""LastChangeToken"" type=""s:string"" />
                                  <s:attribute name=""MoreChanges"" type=""core:TRUEFALSE"" />
                                  <s:attribute name=""MinTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                  <s:attribute name=""RecommendedTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                  <s:attribute name=""MaxBulkDocumentSyncSize"" type=""s:unsignedInt"" />
                                  <s:attribute name=""MaxRecommendedEmbeddedFileSize"" type=""s:unsignedInt"" />
                                  <s:attribute name=""AlternateUrls"" type=""s:string"" />
                                  <s:attribute name=""EffectivePermMask"" type=""s:string"" />
                                </s:complexType>
                              </s:element>
                              <s:any />
                            </s:sequence> 
                          </s:complexType>
                        </s:element>
                      </s:sequence>
                    </s:complexType>
                  </s:element>
                </s:sequence>     
              </s:complexType>
            </s:element>");

            // Verify R1898
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1898,
                @"[GetListItemChangesSinceTokenResponse]GetListItemChangesSinceTokenResult:  The top-level element, which contains a listitems element.");

            // Verify R1908
            // In MS-LISTSWS.wsdl. The 'any' element has been replaced by rs:data.
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1908,
                @"[GetListItemChangesSinceTokenResponse]The listitems element also contains an inner element named rs:data, which is of type DataDefinition ListItemCollectionPositionNext (section 2.2.4.7).");

            // Verify R2486
            if (Common.IsRequirementEnabled(2486, this.Site))
            {
                if (getListItemChangesSinceTokenResult.listitems.Changes.List != null)
                {
                    bool isFileFragmentExist = getListItemChangesSinceTokenResult.listitems.Changes.List.Fields.Field.Any(field => field.Name == "FileFragment");
                    Site.CaptureRequirementIfIsFalse(
                        isFileFragmentExist,
                        2486,
                        @"[In GetListItemChangesSinceToken operation]Implementation does not return the FileFragment element.[In Appendix B: Product Behavior] <61> Section 3.1.4.22.2.2: In Windows SharePoint Services 3.0, the FileFragment element is not returned.");
                }
            }

            // Verify the requirements of the DataDefinition complex type.
            if (getListItemChangesSinceTokenResult.listitems.data != null)
            {
                this.VerifyDataDefinition(getListItemChangesSinceTokenResult.listitems.data);
            }

            // Verify the requirements of the ListDefinitionSchema complex type.
            if (getListItemChangesSinceTokenResult.listitems.Changes.List != null)
            {
                this.VerifyListDefinitionSchema(getListItemChangesSinceTokenResult.listitems.Changes.List);
            }

            // Verify the requirements of the ListItemChangeDefinition complex type.
            if (null != getListItemChangesSinceTokenResult.listitems && null != getListItemChangesSinceTokenResult.listitems.Changes
                && null != getListItemChangesSinceTokenResult.listitems.Changes && null != getListItemChangesSinceTokenResult.listitems.Changes.Id)
            {
                this.VerifyListItemChangeDefinition(getListItemChangesSinceTokenResult.listitems.Changes.Id);
                this.VerifyServerChangeUnitAttributeNotReturn(getListItemChangesSinceTokenResult.listitems.Changes.Id);
            }

            // Verify the requirements of the EnumViewAttributes simple type.
            if (queryOptions != null)
            {
                if (getListItemChangesSinceTokenResult.listitems.data.Any != null)
                {
                    DataTable data = AdapterHelper.ExtractData(getListItemChangesSinceTokenResult.listitems.data.Any);
                    string author = data.Columns.Contains("ows_Author") ? Convert.ToString(data.Rows[0]["ows_Author"]) : null;
                    this.VerifyCamlQueryOptions(queryOptions, viewFields, author);
                }

                if (queryOptions.QueryOptions != null)
                {
                    if (queryOptions.QueryOptions.ViewAttributes != null)
                    {
                        if (queryOptions.QueryOptions.ViewAttributes.ScopeSpecified)
                        {
                            this.VerifyEnumViewAttributes();
                        }
                    }
                }
            }
            // Verify R1907
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                   1907,
                   @"[GetListItemChangesSinceTokenResponse]Note that set of fields returned by the method is restricted by the viewField or viewName parameter.");
        }
 /// <remarks/>
 public System.IAsyncResult BeginGetListItems(string listName, string viewName, GetListItemsQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string webID, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetListItems", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             webID}, callback, asyncState);
 }
 /// <remarks/>
 public void GetListItemsAsync(string listName, string viewName, GetListItemsQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string webID)
 {
     this.GetListItemsAsync(listName, viewName, query, viewFields, rowLimit, queryOptions, webID, null);
 }
 public GetListItemsResponseGetListItemsResult GetListItems(string listName, string viewName, GetListItemsQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string webID)
 {
     object[] results = this.Invoke("GetListItems", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             webID});
     return ((GetListItemsResponseGetListItemsResult)(results[0]));
 }
 /// <summary>
 /// This method is used to construct a CamlQueryOptions instance using the following 
 /// specified value :RecurrenceOrderBy – True, 
 ///                 ViewAttributes – Scope= RecursiveAll, 
 ///                 DateInUtc –True,
 ///                 IncludePermissions – True, 
 ///                 IncludeAttachmentUrls – True, 
 ///                 IncludeAttachmentVersion – True, 
 ///                 RecurrencePatternXMLVersion – v3, 
 ///                 ExpandUserField – True, 
 ///                 MeetingInstanceID – -1.
 /// </summary>
 /// <returns>This method returns the CamlQueryOptions instance using the default specified value.</returns>
 private static CamlQueryOptions CreateDefaultCamlQueryOptions()
 {
     CamlQueryOptions options = new CamlQueryOptions();
     options.QueryOptions = new CamlQueryOptionsQueryOptions();
     options.QueryOptions.RecurrenceOrderBy = "True";
     options.QueryOptions.ViewAttributes = new CamlQueryOptionsQueryOptionsViewAttributes();
     options.QueryOptions.ViewAttributes.ScopeSpecified = true;
     options.QueryOptions.ViewAttributes.Scope = EnumViewAttributes.RecursiveAll;
     options.QueryOptions.DateInUtc = "True";
     options.QueryOptions.IncludePermissions = "True";
     options.QueryOptions.IncludeAttachmentUrls = "True";
     options.QueryOptions.IncludeAttachmentVersion = "True";
     options.QueryOptions.RecurrencePatternXMLVersionSpecified = true;
     options.QueryOptions.RecurrencePatternXMLVersion = EnumRecurrencePatternXMLVersion.v3;
     options.QueryOptions.ExpandUserField = "True";
     options.QueryOptions.MeetingInstanceID = "-1";
     return options;
 }
        public void MSLISTSWS_S03_TC66_IncludeMandatoryColumns()
        {
            #region Create a new generic list
            int templateId = (int)TemplateType.Generic_List;
            string listName = TestSuiteHelper.CreateList(templateId);
            #endregion

            #region Add a new "Required" field in the generic list
            string newRequiredField = TestSuiteHelper.GetUniqueFieldName();
            TestSuiteHelper.AddFieldsToList(
                                    listName,
                                    new List<string> { newRequiredField },
                                    new List<string> { "Counter" },
                                    true,
                                    new List<string> { null });
            #endregion

            #region Add a new list item in the generic list with a valid value for the "Required" field
            UpdateListItemsUpdates listItemUpdates_1 = new UpdateListItemsUpdates();
            listItemUpdates_1.Batch = new UpdateListItemsUpdatesBatch();
            listItemUpdates_1.Batch.Method = new UpdateListItemsUpdatesBatchMethod[1];
            listItemUpdates_1.Batch.Method[0] = new UpdateListItemsUpdatesBatchMethod();
            listItemUpdates_1.Batch.Method[0].ID = (uint)0;
            listItemUpdates_1.Batch.Method[0].Cmd = MethodCmdEnum.New;
            listItemUpdates_1.Batch.Method[0].Field = new UpdateListItemsUpdatesBatchMethodField[1];
            listItemUpdates_1.Batch.Method[0].Field[0] = new UpdateListItemsUpdatesBatchMethodField();
            listItemUpdates_1.Batch.Method[0].Field[0].Name = newRequiredField;
            listItemUpdates_1.Batch.Method[0].Field[0].Value = "30";
            this.listswsAdapter.UpdateListItems(listName, listItemUpdates_1);
            #endregion

            #region Invoke the operation "GetListItems" to check the "Required" field.
            GetListItemsResponseGetListItemsResult getListItemsResult = null;
            CamlViewFields viewFields = new CamlViewFields();
            viewFields.ViewFields = new CamlViewFieldsViewFields();
            viewFields.ViewFields.FieldRef = new CamlViewFieldsViewFieldsFieldRef[1];
            viewFields.ViewFields.FieldRef[0] = new CamlViewFieldsViewFieldsFieldRef();
            viewFields.ViewFields.FieldRef[0].Name = "ID";
            CamlQueryOptions queryOption = new CamlQueryOptions();
            queryOption.QueryOptions = new CamlQueryOptionsQueryOptions();
            XmlNode[] row = null;
            System.Collections.IEnumerator attributeEnumerator = null;
            string attribute_NewRequiredField = "ows_" + newRequiredField;

            // Invoke "GetListItems" operation with the value of request element "IncludeMandatoryColumns" is "TRUE".
            queryOption.QueryOptions.IncludeMandatoryColumns = "TRUE";
            getListItemsResult = this.listswsAdapter.GetListItems(listName, null, null, viewFields, null, queryOption, null);
            Site.Assert.IsNotNull(getListItemsResult.listitems, "The \"listitems\" is null in the first invoke of \"GetListItems\"!");
            Site.Assert.IsNotNull(getListItemsResult.listitems.data, "The \"listitems.data\" is null in the first invoke of \"GetListItems\"!");
            Site.Assert.IsNotNull(getListItemsResult.listitems.data.Any, "The \"listitems.data.Any\" is null in the first invoke of \"GetListItems\"!");
            row = getListItemsResult.listitems.data.Any;
            Site.Assert.IsNotNull(row[0], "The \"row[0]\" is null in the first invoke of \"GetListItems\"!");
            Site.Assert.IsNotNull(row[0].Attributes, "The \"row[0].Attributes\" is null in the first invoke of \"GetListItems\"!");
            attributeEnumerator = row[0].Attributes.GetEnumerator();

            // Check if the "Required" field appears as one attribute of "z:row" element in the response of "GetListItems".
            bool findRequiredField_IncludeMandatoryColumns = false;
            while (attributeEnumerator.MoveNext())
            {
                XmlAttribute curAttribute = (XmlAttribute)attributeEnumerator.Current;
                if (string.Compare(curAttribute.Name, attribute_NewRequiredField, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    findRequiredField_IncludeMandatoryColumns = true;
                    break;
                }
            }

            // Invoke "GetListItems" operation with the value of request element "IncludeMandatoryColumns" is "FALSE".
            queryOption.QueryOptions.IncludeMandatoryColumns = "FALSE";
            getListItemsResult = this.listswsAdapter.GetListItems(listName, null, null, viewFields, null, queryOption, null);
            Site.Assert.IsNotNull(getListItemsResult.listitems, "The \"listitems\" is null in the second invoke of \"GetListItems\"!");
            Site.Assert.IsNotNull(getListItemsResult.listitems.data, "The \"listitems.data\" is null in the second invoke of \"GetListItems\"!");
            Site.Assert.IsNotNull(getListItemsResult.listitems.data.Any, "The \"listitems.data.Any\" is null in the second invoke of \"GetListItems\"!");
            row = getListItemsResult.listitems.data.Any;
            Site.Assert.IsNotNull(row[0], "The \"row[0]\" is null in the second invoke of \"GetListItems\"!");
            Site.Assert.IsNotNull(row[0].Attributes, "The \"row[0].Attributes\" is null in the second invoke of \"GetListItems\"!");
            attributeEnumerator = row[0].Attributes.GetEnumerator();

            // Check if the "Required" field does not appear as one attribute of "z:row" element in the response of "GetListItems".
            bool findRequiredField_NotIncludeMandatoryColumns = false;
            while (attributeEnumerator.MoveNext())
            {
                XmlAttribute curAttribute = (XmlAttribute)attributeEnumerator.Current;
                if (string.Compare(curAttribute.Name, attribute_NewRequiredField, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    findRequiredField_NotIncludeMandatoryColumns = true;
                    break;
                }
            }
            #endregion

            #region Try to confirm the requirement #1256.
            // Capture the requirement #1256 when following 2 conditions are all satisfied:
            //  1. The "Required" field appears as one attribute of "z:row" element in the response of "GetListItems",
            //      when the value of request element "IncludeMandatoryColumns" is "TRUE";
            //  2. The "Required" field does not appear as one attribute of "z:row" element in the response of "GetListItems",
            //      when the value of request element "IncludeMandatoryColumns" is "FALSE";
            bool confirmR1256 = false;
            if (findRequiredField_IncludeMandatoryColumns && !findRequiredField_NotIncludeMandatoryColumns)
            {
                confirmR1256 = true;
            }

            Site.CaptureRequirementIfIsTrue(
                confirmR1256,
                1256,
                "[IncludeMandatoryColumns]Specifies that required fields and fields used by specified calculated fields be returned in addition to the fields specified by the viewFields parameter if set to True.");

            #endregion
        }
 /// <remarks/>
 public void GetListItemChangesSinceTokenAsync(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains, object userState)
 {
     if ((this.GetListItemChangesSinceTokenOperationCompleted == null))
     {
         this.GetListItemChangesSinceTokenOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetListItemChangesSinceTokenOperationCompleted);
     }
     this.InvokeAsync("GetListItemChangesSinceToken", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             changeToken,
             contains}, this.GetListItemChangesSinceTokenOperationCompleted, userState);
 }
 public GetListItemChangesWithKnowledgeResponseGetListItemChangesWithKnowledgeResult GetListItemChangesWithKnowledge(string listName, string viewName, GetListItemChangesWithKnowledgeQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string syncScope, GetListItemChangesWithKnowledgeKnowledge knowledge, CamlContains contains)
 {
     object[] results = this.Invoke("GetListItemChangesWithKnowledge", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             syncScope,
             knowledge,
             contains});
     return ((GetListItemChangesWithKnowledgeResponseGetListItemChangesWithKnowledgeResult)(results[0]));
 }
        /// <summary>
        /// Verify the requirements of the complex type CamlQueryOptions.
        /// </summary>
        /// <param name="query">The actual CamlQueryOptions.</param>
        /// <param name="viewFields">Specifies which fields of the list item should be returned</param>
        /// <param name="returnedAuthorField">The actual returned Author field.</param>
        private void VerifyCamlQueryOptions(
            CamlQueryOptions query,
            CamlViewFields viewFields,
            string returnedAuthorField)
        {
            Site.Assert.IsNotNull(query, "The CamlQueryOptions cannot be null");

            // Verify R34
            bool authorContained = false;
            if (viewFields != null)
            {
                if (viewFields.ViewFields != null)
                {
                    if (viewFields.ViewFields.FieldRef != null)
                    {
                        foreach (CamlViewFieldsViewFieldsFieldRef fr in viewFields.ViewFields.FieldRef)
                        {
                            if (string.Compare(fr.Name, AdapterHelper.FieldAuthorName, StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                authorContained = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(query.QueryOptions.ExpandUserField))
            {
                if (bool.Parse(query.QueryOptions.ExpandUserField) && authorContained)
                {
                    // Verify MS-LISTSWS requirement: MS-LISTSWS_R34
                    // If the returned Author field contains ",#", which means "Name", 
                    // "EMail", "SipAddress", and "Title" fields from the user information List are 
                    // returned, then the requirement can be captured.
                    bool isVerifyR34 = false;
                    if (!string.IsNullOrEmpty(returnedAuthorField))
                    {
                        isVerifyR34 = returnedAuthorField.Contains(",#");
                    }

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR34,
                        34,
                        @"[In CAMLQueryOptions] [ExpandUserField] If set to True, specifies that fields "
                        + "in list items that are lookup fields to the user information list are returned as "
                        + @"if they were multi-value lookups, including ""Name"", ""EMail"", "
                        + @"""SipAddress"", and ""Title"" fields from the user information List for the "
                        + "looked-up item.");
                }
            }
        }
 /// <remarks/>
 public System.IAsyncResult BeginGetListItemChangesWithKnowledge(string listName, string viewName, GetListItemChangesWithKnowledgeQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string syncScope, GetListItemChangesWithKnowledgeKnowledge knowledge, CamlContains contains, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetListItemChangesWithKnowledge", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             syncScope,
             knowledge,
             contains}, callback, asyncState);
 }
        /// <summary>
        /// Verify the message syntax of GetListItemChangesWithKnowledge operation when the 
        /// response is received successfully.
        /// </summary>
        /// <param name="getListItemChangesWithKnowledgeResult">The result of the operation</param>
        /// <param name="queryOptions">Specifies various options for modifying the query</param>
        /// <param name="viewFields">Specifies which fields of the list item will be returned</param>
        private void VerifyGetListItemChangesWithKnowledgeOperation(
            GetListItemChangesWithKnowledgeResponseGetListItemChangesWithKnowledgeResult getListItemChangesWithKnowledgeResult,
            CamlQueryOptions queryOptions,
            CamlViewFields viewFields)
        {
            if (getListItemChangesWithKnowledgeResult != null)
            {
                // Verify R1079
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    1079,
                    @"[The schema of GetListItemChangesWithKnowledge is defined as:]"
                    + @"<wsdl:operation name=""GetListItemChangesWithKnowledge"">"
                    + @"    <wsdl:input message=""GetListItemChangesWithKnowledgeSoapIn"" />"
                    + @"    <wsdl:output message=""GetListItemChangesWithKnowledgeSoapOut"" />"
                    + @"</wsdl:operation>");

                // Verify R1081
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    1081,
                    @"[In GetListItemChangesWithKnowledge operation]The protocol client sends a "
                    + "GetListItemChangesWithKnowledgeSoapIn request message ,the protocol "
                    + "server responds with a GetListItemChangesWithKnowledgeSoapOut response "
                    + "message,");

                // Verify R1096
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    1096,
                    @"[In GetListItemChangeswithKnowledgeSoapOut]The SOAP Body contains a "
                    + "GetListItemChangesWithKnowledgeResponse element.");

                // Verify R1124
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    1124,
                    @"[The schema of GetListItemChangesWithKnowledgeResponse is defined as: ]
                <s:element name=""GetListItemChangesWithKnowledgeResponse"">
                  <s:complexType>
                    <s:sequence>
                      <s:element minOccurs=""0"" maxOccurs=""1"" name=""GetListItemChangesWithKnowledgeResult"">
                        <s:complexType mixed=""true"">
                          <s:sequence>
                            <s:element name=""listitems"" >
                              <s:complexType>
                                <s:sequence>
                                  <s:element name=""Changes"" >
                                    <s:complexType>
                                      <s:sequence>
                                        <s:element name=""MadeWithKnowledge"" minOccurs=""0"" maxOccurs=""1"">
                                          <s:complexType>
                                            <s:sequence>
                                              <s:element ref=""sync:syncKnowledge"" />
                                            </s:sequence>
                                          </s:complexType>
                                        </s:element>
                                        <s:element name=""Id"" type=""tns:ListItemChangeDefinition"" minOccurs=""0""/>
                                        <s:element name=""View"" type=""tns:ViewChangeDefinition"" minOccurs=""0""/>
                                      </s:sequence>
                                      <s:attribute name=""SchemaChanged"" type=""core:TRUEFALSE"" />
                                      <s:attribute name=""ServerTime"" type=""s:string"" />
                                      <s:attribute name=""MoreChanges"" type=""core:TRUEFALSE"" />
                                      <s:attribute name=""MinTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                      <s:attribute name=""RecommendedTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                      <s:attribute name=""MaxBulkDocumentSyncSize"" type=""s:unsignedInt"" />
                                      <s:attribute name=""MaxRecommendedEmbeddedFileSize"" type=""s:unsignedInt"" />
                                      <s:attribute name=""AlternateUrls"" type=""s:string"" />
                                      <s:attribute name=""EffectivePermMask"" type=""s:string"" />
                                    </s:complexType>
                                  </s:element>
                                  <s:any />
                                </s:sequence>
                              </s:complexType>
                            </s:element>
                          </s:sequence>
                        </s:complexType>
                      </s:element>
                    </s:sequence>     
                  </s:complexType>
                </s:element>");

                // Verify R1125
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured.
                Site.CaptureRequirement(
                    1125,
                    @"[In GetListItemChangesWithKnowledgeResponse]GetListItemChangesWithKnowledgeResult: The top-level element, which contains a listitems element.");

                // Verify R1137
                // The schema from MS-XSSK has been added to MS-LISTSWS.wsdl.
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured.
                Site.CaptureRequirement(
                    1137,
                    @"[In GetListItemChangesWithKnowledgeResponse]The inner XML of the MadeWithKnowledge element in the Changes element is the knowledge in XML format, as specified in [MS-XSSK] section 3, that represents the last change in the list that is returned to the client.");

                // Verify R1145
                // The response have been received successfully, which means the schema
                // of the listitems element past the validation, then the following requirement can be 
                // captured.
                Site.CaptureRequirement(
                    1145,
                    @"[In GetListItemChangesWithKnowledgeResponse]The listitems element also "
                    + "contains an inner element named rs:data, which is of type DataDefinition. (section 2.2.4.7)");

                // Verify MS-LISTSWS requirement: MS-LISTSWS_R1361
                // If the Created can be parsed to a DateTime, capture R1135
                if (null != getListItemChangesWithKnowledgeResult.listitems && null != getListItemChangesWithKnowledgeResult.listitems.Changes
                    && !string.IsNullOrEmpty(getListItemChangesWithKnowledgeResult.listitems.Changes.ServerTime))
                {
                    DateTime created;
                    string paserFormat = @"yyyyMMdd HH:mm:ss";
                    string returnDataTimeValue = getListItemChangesWithKnowledgeResult.listitems.Changes.ServerTime;
                    bool isVerifyR1135 = DateTime.TryParseExact(returnDataTimeValue, paserFormat, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out created);

                    Site.Log.Add(
                        LogEntryKind.Debug,
                        "The actual values: returnDataTimeValue[{0}] for requirement #R1361",
                        string.IsNullOrEmpty(returnDataTimeValue) ? "NullOrEmpty" : returnDataTimeValue);

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR1135,
                        1135,
                        @"[In GetListItemChangesWithKnowledgeResponse][Attribute of ServerTime]The ServerTime attribute specifies the UTC date and time in the Gregorian calendar "
                        + @"when the changes were returned by the server in the format ""yyyyMMdd hh:mm:ss"" where ""yyyy"" represents the year, ""MM"" represents the month, ""dd"" represents the day of the month, "
                        + @"""hh"" represents the hour, ""mm"" represents the minute, and ""ss"" represents the second.");
                }
            }

            if ((queryOptions != null)
                && (getListItemChangesWithKnowledgeResult.listitems.data.Any != null))
            {
                DataTable data = AdapterHelper.ExtractData(getListItemChangesWithKnowledgeResult.listitems.data.Any);
                string author = data.Columns.Contains("ows_Author") ? Convert.ToString(data.Rows[0]["ows_Author"]) : null;
                this.VerifyCamlQueryOptions(queryOptions, viewFields, author);
            }

            // Verify the requirements of the DataDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.data != null)
            {
                this.VerifyDataDefinition(getListItemChangesWithKnowledgeResult.listitems.data);
            }

            // Verify the requirements of FileFolderChangeDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.Changes.File != null)
            {
                this.VerifyFileFolderChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.File);
            }

            if (getListItemChangesWithKnowledgeResult.listitems.Changes.Folder != null)
            {
                this.VerifyFileFolderChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.Folder);
            }

            // Verify the requirements of FileFragmentChangeDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.Changes.FileFragment != null)
            {
                this.VerifyFileFragmentChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.FileFragment);
            }

            // Verify the requirements of the ListItemChangeDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.Changes.Id != null)
            {
                this.VerifyListItemChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.Id[0]);
            }

            // Verify the requirements of the EnumViewAttributes simple type.
            if (queryOptions != null)
            {
                if (queryOptions.QueryOptions != null)
                {
                    if (queryOptions.QueryOptions.ViewAttributes != null)
                    {
                        if (queryOptions.QueryOptions.ViewAttributes.ScopeSpecified)
                        {
                            this.VerifyEnumViewAttributes();
                        }
                    }
                }
            }
        }
 /// <remarks/>
 public void GetListItemChangesWithKnowledgeAsync(string listName, string viewName, GetListItemChangesWithKnowledgeQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string syncScope, GetListItemChangesWithKnowledgeKnowledge knowledge, CamlContains contains)
 {
     this.GetListItemChangesWithKnowledgeAsync(listName, viewName, query, viewFields, rowLimit, queryOptions, syncScope, knowledge, contains, null);
 }
        /// <summary>
        /// The GetListItemChangesSinceToken operation is used to return changes made to a specified list after the event
        /// expressed by the change token, if specified, or to return all the list items in the list.
        /// </summary>
        /// <param name="listName">The name of the list from which version collection will be got</param>
        /// <param name="viewName">The GUID refers to a view of the list</param>
        /// <param name="query">The query to determine which records from the list are to be 
        /// returned and the order in which they will be returned</param>
        /// <param name="viewFields">Specifies which fields of the list item will be returned</param>
        /// <param name="rowLimit">Indicate the maximum number of rows of data to return</param>
        /// <param name="queryOptions">Specifies various options for modifying the query</param>
        /// <param name="changeToken">Assigned a string comprising a token returned by a previous 
        /// call to this operation.</param>
        /// <param name="contains">Specifies a value to search for</param>
        /// <returns>A return value represent the list item changes since the specified token</returns>
        public GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult GetListItemChangesSinceToken(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains)
        {
            if (null == this.listsProxy)
            {
                throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter");
            }

            GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult result = null;
            result = this.listsProxy.GetListItemChangesSinceToken(listName, viewName, query, viewFields, rowLimit, queryOptions, changeToken, contains);
            this.VerifyTransportRequirement();
            this.VerifyGetListItemChangesSinceTokenResponse(result);

            return result;
        }
 /// <remarks/>
 public void GetListItemChangesWithKnowledgeAsync(string listName, string viewName, GetListItemChangesWithKnowledgeQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string syncScope, GetListItemChangesWithKnowledgeKnowledge knowledge, CamlContains contains, object userState)
 {
     if ((this.GetListItemChangesWithKnowledgeOperationCompleted == null))
     {
         this.GetListItemChangesWithKnowledgeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetListItemChangesWithKnowledgeOperationCompleted);
     }
     this.InvokeAsync("GetListItemChangesWithKnowledge", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             syncScope,
             knowledge,
             contains}, this.GetListItemChangesWithKnowledgeOperationCompleted, userState);
 }
        /// <summary>
        /// This operation is used to retrieve details about list items in a list that satisfy specified criteria.
        /// </summary>
        /// <param name="listName">The name of the list from which item changes will be got</param>
        /// <param name="viewName">The GUID refers to a view of the list</param>
        /// <param name="query">The query to determine which records from the list are to be returned </param>
        /// <param name="viewFields">Specifies which fields of the list item should be returned</param>
        /// <param name="rowLimit">Specifies the maximum number of rows of data to return in the response</param>
        /// <param name="queryOptions">Specifies various options for modifying the query</param>
        /// <param name="webID">The GUID of the site that contains the list. If not specified, the default Web site based on the SOAP request is used</param>
        /// <returns>Get list item result</returns>
        public GetListItemsResponseGetListItemsResult GetListItems(string listName, string viewName, GetListItemsQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string webID)
        {
            this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized");

            GetListItemsResponseGetListItemsResult result = null;
            try
            {
                result = this.listsProxy.GetListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, webID);

                // Verify the requirements of the GetListItems operation.
                this.VerifyGetListItemsOperation(result, queryOptions, viewFields);

                // Verify the requirements of the transport.
                this.VerifyTransportRequirements();
            }
            catch (XmlSchemaValidationException exp)
            {
                // Log the errors and warnings
                this.LogSchemaValidationErrors();

                this.Site.Assert.Fail(exp.Message);
            }
            catch (SoapException)
            {
                this.VerifySoapExceptionFault();
                throw;
            }

            return result;
        }
        public void MSLISTSWS_S03_TC55_GetListItems_WithPaging()
        {
            // Create a list.
            string listId = TestSuiteHelper.CreateList();

            // Insert 10 item.
            List<string> addedItems = TestSuiteHelper.AddListItems(listId, 10);

            // Sorted the list to make sure order by Ascending.
            addedItems = addedItems.OrderBy<string, int>(key => Convert.ToInt32(key)).ToList();

            // Create Query element to make the z:row ordered by OWS_ID Ascending.
            GetListItemsQuery query = new GetListItemsQuery();
            query.Query = new CamlQueryRoot();
            query.Query.OrderBy = new OrderByDefinition();
            query.Query.OrderBy.FieldRef = new FieldRefDefinitionOrderBy[1];
            query.Query.OrderBy.FieldRef[0] = new FieldRefDefinitionOrderBy();
            query.Query.OrderBy.FieldRef[0].Name = AdapterHelper.FieldIDName;
            query.Query.OrderBy.FieldRef[0].Ascending = "TRUE";

            // Set the row limit.
            string rowLimit = "2";

            // Call the GetListItems excluding the paging.
            GetListItemsResponseGetListItemsResult result = null;
            result = this.listswsAdapter.GetListItems(
                                    listId,
                                    null,
                                    query,
                                    null,
                                    rowLimit,
                                    null,
                                    null);

            // Call GetListItems with ListItemCollectionPositionNext which is got by previous call.
            CamlQueryOptions options = new CamlQueryOptions();
            options.QueryOptions = new CamlQueryOptionsQueryOptions();
            options.QueryOptions.Paging = new CamlQueryOptionsQueryOptionsPaging();
            options.QueryOptions.Paging.ListItemCollectionPositionNext = result.listitems.data.ListItemCollectionPositionNext;
            result = this.listswsAdapter.GetListItems(
                                    listId,
                                    null,
                                    query,
                                    null,
                                    null,
                                    options,
                                    null);

            string columnNameId = AdapterHelper.PrefixOws + AdapterHelper.FieldIDName;
            DataTable data = AdapterHelper.ExtractData(result.listitems.data.Any);

            // If the returned first z:row ows_ID equals the next page's first addedItems element, 
            // Then capture requirement R1252.
            bool isNextPage = Convert.ToString(data.Rows[0][columnNameId]) == addedItems[Convert.ToInt32(rowLimit)];
            Site.CaptureRequirementIfIsTrue(
                isNextPage,
                1252,
                @"[Paging]The protocol server MUST return the next page of data based on the "
                + "bookmark supplied.");
        }