/// <summary> /// The UpdateListItems operation is used to insert, update, and delete to specified list items in a list. /// </summary> /// <param name="listName">The name of the list for which list items will be updated</param> /// <param name="updates">Specifies the operations to perform on a list item</param> /// <returns>return the updated list items</returns> public UpdateListItemsResponseUpdateListItemsResult UpdateListItems(string listName, UpdateListItemsUpdates updates) { this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized"); UpdateListItemsResponseUpdateListItemsResult result = null; try { result = this.listsProxy.UpdateListItems(listName, updates); // Verify the requirements of the UpdateListItems operation. this.VerifyUpdateListItemsOperation(result, updates); // 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; }
/// <summary> /// A method used to construct UpdateListItemsUpdates instance using the specified parameters. /// </summary> /// <param name="methodCollection">A list of MethodCmdEnum to specify the operations.</param> /// <param name="fieldNameValuePairs">A list of items values.</param> /// <param name="errorhandleType">Specify the OnError of the Batch element's value.</param> /// <returns>Returns the UpdateListItemsUpdates instance.</returns> public static UpdateListItemsUpdates CreateUpdateListItems( List<MethodCmdEnum> methodCollection, List<Dictionary<string, string>> fieldNameValuePairs, OnErrorEnum errorhandleType) { testSite.Debug.IsNotNull( methodCollection, "The [methodCollection] parameter in CreateUpdateListItems can not be null"); testSite.Debug.IsNotNull( fieldNameValuePairs, "The [methodCollection] parameter in CreateUpdateListItems can not be null"); testSite.Debug.AreEqual<int>( methodCollection.Count, fieldNameValuePairs.Count, "The element number in the methods and fieldNameValuePairs parameter List are same"); UpdateListItemsUpdates updates = new UpdateListItemsUpdates(); updates.Batch = new UpdateListItemsUpdatesBatch(); updates.Batch.Method = new UpdateListItemsUpdatesBatchMethod[methodCollection.Count]; for (int i = 0; i < methodCollection.Count; i++) { updates.Batch.OnError = errorhandleType; updates.Batch.OnErrorSpecified = true; updates.Batch.Method[i] = new UpdateListItemsUpdatesBatchMethod(); updates.Batch.Method[i].Cmd = methodCollection[i]; int fieldCount = fieldNameValuePairs[i].Keys.Count; updates.Batch.Method[i].Field = new UpdateListItemsUpdatesBatchMethodField[fieldCount]; int j = 0; foreach (KeyValuePair<string, string> keyPair in fieldNameValuePairs[i]) { updates.Batch.Method[i].Field[j] = new UpdateListItemsUpdatesBatchMethodField(); updates.Batch.Method[i].Field[j].Name = keyPair.Key; updates.Batch.Method[i].Field[j].Value = keyPair.Value; j++; } } return updates; }
/// <summary> /// A method is used to insert one item which only contains "MetaInfo" field value. /// This method is constraint to only add one property to the lookup type "MetaInfo" field. /// </summary> /// <param name="list">A parameter represents list GUID or list title.</param> /// <param name="propertyName">A parameter represents one property name for the lookup type "MetaInfo" field.</param> /// <param name="propertyValue">A parameter represents the property value for the corresponding property name.</param> /// <returns>A return value represents the item's id.</returns> public static string AddListItemWithMetaInfoProperty(string list, string propertyName, string propertyValue) { UpdateListItemsUpdates updates = new UpdateListItemsUpdates(); updates.Batch = new UpdateListItemsUpdatesBatch(); updates.Batch.Method = new UpdateListItemsUpdatesBatchMethod[1]; updates.Batch.Method[0] = new UpdateListItemsUpdatesBatchMethod(); updates.Batch.Method[0].ID = 0; updates.Batch.Method[0].Cmd = MethodCmdEnum.New; updates.Batch.Method[0].Field = new UpdateListItemsUpdatesBatchMethodField[1]; updates.Batch.Method[0].Field[0] = new UpdateListItemsUpdatesBatchMethodField(); updates.Batch.Method[0].Field[0].Name = "MetaInfo"; updates.Batch.Method[0].Field[0].Property = propertyName; updates.Batch.Method[0].Field[0].Value = propertyValue; return AddListItem(list, updates); }
/// <summary> /// The UpdateListItems operation is used to insert, update, and delete to specified list items in a list. /// </summary> /// <param name="listName">The name of the list for which list items will be updated</param> /// <param name="updates">Specifies the operations to perform on a list item</param> /// <returns>return the updated list items</returns> public UpdateListItemsResponseUpdateListItemsResult UpdateListItems(string listName, UpdateListItemsUpdates updates) { if (null == this.listsProxy) { throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter"); } UpdateListItemsResponseUpdateListItemsResult result = null; result = this.listsProxy.UpdateListItems(listName, updates); this.VerifyTransportRequirement(); return result; }
/// <summary> /// A method is used to insert one item to the specified list. /// </summary> /// <param name="list">A parameter represents list GUID or list title.</param> /// <param name="updates">A parameter represents UpdateListItemsUpdates instances.</param> /// <returns>This method will return the item's ID.</returns> private static string AddListItem(string list, UpdateListItemsUpdates updates) { UpdateListItemsResponseUpdateListItemsResult result = null; try { result = listswsAdapter.UpdateListItems( list, updates); } catch (SoapException exp) { testSite.Debug.Fail(ErrorMessageTemplate, "adding items in the list " + list, exp.Detail.InnerText); } testSite.Assert.AreEqual<int>( 1, result.Results.Count(), "The result must contain one result"); DataTable data = AdapterHelper.ExtractData(result.Results[0].Any); string columnNameId = string.Format("{0}{1}", AdapterHelper.PrefixOws, "ID"); testSite.Assert.AreEqual<int>( 1, data.Rows.Count, "There MUST be one z:row"); // There MUST be one column called ID return Convert.ToString(data.Rows[0][columnNameId]); }
/// <summary> /// The UpdateListItems operation is used to insert, update, and delete to specified list items in a list. /// </summary> /// <param name="listName">The name of the list for which list items will be updated</param> /// <param name="updates">Specifies the operations to perform on a list item</param> /// <returns>return the updated list items</returns> public UpdateListItemsResponseUpdateListItemsResult UpdateListItems(string listName, UpdateListItemsUpdates updates) { if (null == this.listsProxy) { throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter"); } UpdateListItemsResponseUpdateListItemsResult result = null; result = this.listsProxy.UpdateListItems(listName, updates); this.VerifyTransportRequirement(); return(result); }
/// <summary> /// Verify the message syntax of UpdateListItems operation when the response is received /// successfully. /// </summary> /// <param name="updateListItemsResult">The result of the operation.</param> /// <param name="updates">The updates parameter of the method.</param> private void VerifyUpdateListItemsOperation( UpdateListItemsResponseUpdateListItemsResult updateListItemsResult, UpdateListItemsUpdates updates) { // Verify R2067 // 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( 2067, @"[The schema of UpdateListItems is defined as:]" + @"<wsdl:operation name=""UpdateListItems"">" + @" <wsdl:input message=""UpdateListItemsSoapIn"" />" + @" <wsdl:output message=""UpdateListItemsSoapOut"" />" + @"</wsdl:operation>"); // Verify R905 // 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( 905, @"[In UpdateListItems operation] [If the protocol client sends an " + "UpdateListItemsSoapIn request message] the protocol server responds with an " + "UpdateListItemsSoapOut response message."); // Verify R2072 // 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( 2072, @"[UpdateListItemsSoapOut]The SOAP Body contains an UpdateListItemsResponse " + "element"); // Verify R2111 // 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( 2111, @"[The schema of UpdateListItemsResponse is defined as:] <s:element name=""UpdateListItemsResponse""> <s:complexType> <s:sequence> <s:element minOccurs=""0"" maxOccurs=""1"" name=""UpdateListItemsResult""> <s:complexType mixed=""true""> <s:sequence> <s:element name=""Results"" > <s:complexType> <s:sequence> <s:element name=""Result"" maxOccurs=""unbounded""> <s:complexType> <s:sequence> <s:element name=""ErrorCode"" type=""s:string"" /> <s:any minOccurs=""0"" maxOccurs=""unbounded"" /> </s:sequence> <s:attribute name=""ID"" type=""s:string"" /> <s:attribute name=""List"" type=""s:string""/> <s:attribute name=""Version"" type=""s:string""/> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType></s:element>"); // Ensure the SOAP result is de-serialized successfully. Site.Assume.IsNotNull( updateListItemsResult, "The result of UpdateListItems operation must not be null."); // If the first returned ID attribute is the Method ID, followed by a comma, // followed by the Method operation, then the following requirements can be // captured. for (int i = 0; i < updates.Batch.Method.Length; i++) { bool isVerifyR962 = false; bool isVerifyR923 = false; string[] strID = updateListItemsResult.Results[i].ID.Split(','); if (strID[0] == updates.Batch.Method[i].ID.ToString() && strID[1] == updates.Batch.Method[i].Cmd.ToString()) { isVerifyR962 = true; isVerifyR923 = true; } // Verify R962 Site.CaptureRequirementIfIsTrue( isVerifyR962, 962, @"[In UpdateListItems operation] [In UpdateListItemsResponse element] [In " + "UpdateListItemsResult element] The ID attribute of the Method parameters " + "MUST correspond to the ID attribute of the Result element and the Result ID " + "is the Method ID, followed by a comma, followed by the Method operation."); // Verify R923 Site.CaptureRequirementIfIsTrue( isVerifyR923, 923, @"[In UpdateListItems operation] [In UpdateListItems element] [In updates " + "element] [In Method element] If the Method ID attribute is unique, the protocol " + "server MUST use the method identification to match up the request made to the " + "protocol server with the protocol server response."); // if ((updateListItemsResult.Results[i].ID == null || updateListItemsResult.Results[i].ID.ToString() == "") && (updateListItemsResult.Results[i].ErrorCode != "")) { Site.CaptureRequirement( 2323001, @"An empty ID element following the ErrorCode element is included, which is reserved for future use. "); } } // Verify R2115 // 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( 2115, @"[UpdateListItemsResponse]The Result element MUST contain an ErrorCode element."); }
/// <remarks/> public void UpdateListItemsAsync(string listName, UpdateListItemsUpdates updates, object userState) { if ((this.UpdateListItemsOperationCompleted == null)) { this.UpdateListItemsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateListItemsOperationCompleted); } this.InvokeAsync("UpdateListItems", new object[] { listName, updates}, this.UpdateListItemsOperationCompleted, userState); }
/// <summary> /// A method used to add a folder into specified document library. /// </summary> /// <param name="listId">A parameter represents the id of a list where the folder is added.</param> /// <param name="folderItemName">A parameter represents the name of folder item which is added to specified list.</param> /// <returns>A return value represents the folder name which is added into the specified document library.</returns> protected string AddFolderIntoList(string listId, string folderItemName) { if (string.IsNullOrEmpty(listId)) { throw new ArgumentException("The value should not be null or empty.", "listId"); } if (string.IsNullOrEmpty(folderItemName)) { throw new ArgumentException("The value should not be null or empty.", "folderItemName"); } UpdateListItemsUpdates listItemUpdates = new UpdateListItemsUpdates(); listItemUpdates.Batch = new UpdateListItemsUpdatesBatch(); listItemUpdates.Batch.Method = new UpdateListItemsUpdatesBatchMethod[1]; listItemUpdates.Batch.Method[0] = new UpdateListItemsUpdatesBatchMethod(); listItemUpdates.Batch.Method[0].ID = (uint)0; listItemUpdates.Batch.Method[0].Cmd = MethodCmdEnum.New; listItemUpdates.Batch.Method[0].Field = new UpdateListItemsUpdatesBatchMethodField[2]; listItemUpdates.Batch.Method[0].Field[0] = new UpdateListItemsUpdatesBatchMethodField(); listItemUpdates.Batch.Method[0].Field[0].Name = "FSObjType"; listItemUpdates.Batch.Method[0].Field[0].Value = "1"; listItemUpdates.Batch.Method[0].Field[1] = new UpdateListItemsUpdatesBatchMethodField(); listItemUpdates.Batch.Method[0].Field[1].Name = "BaseName"; listItemUpdates.Batch.Method[0].Field[1].Value = folderItemName; UpdateListItemsResponseUpdateListItemsResult updateListResult = null; try { updateListResult = OutspsAdapter.UpdateListItems(listId, listItemUpdates); } catch (SoapException) { this.Site.Log.Add(LogEntryKind.Debug, "Add folder[{0}] into List[{0}] fail.", folderItemName, listId); throw; } if (null == updateListResult || null == updateListResult.Results || null == updateListResult.Results || 1 != updateListResult.Results.Length) { this.Site.Assert.Fail("The response of UpdateListItems operation for adding a folder[{0}] should include update result.", folderItemName); } XmlNode[] zrowsdata = this.GetZrowItems(updateListResult.Results[0].Any); // In response of UpdateListItems, only contain one folder added result. string addedFolderItemIdValue = Common.GetZrowAttributeValue(zrowsdata, 0, "ows_Id"); int folderItemId; if (!int.TryParse(addedFolderItemIdValue, out folderItemId)) { this.Site.Assert.Fail("The list item id should be integer format value, current value is [{0}]", addedFolderItemIdValue); } return addedFolderItemIdValue; }
/// <remarks/> public void UpdateListItemsAsync(string listName, UpdateListItemsUpdates updates) { this.UpdateListItemsAsync(listName, updates, null); }
/// <remarks/> public System.IAsyncResult BeginUpdateListItems(string listName, UpdateListItemsUpdates updates, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("UpdateListItems", new object[] { listName, updates}, callback, asyncState); }
public UpdateListItemsResponseUpdateListItemsResult UpdateListItems(string listName, UpdateListItemsUpdates updates) { object[] results = this.Invoke("UpdateListItems", new object[] { listName, updates}); return ((UpdateListItemsResponseUpdateListItemsResult)(results[0])); }
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 }
public void MSLISTSWS_S03_TC43_GetListItems_FilesOnly() { string listTitle = TestSuiteHelper.GetUniqueListName(); int docLibraryTemplateId = (int)TemplateType.Document_Library; string listId = TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId); // Upload the file to the document library IMS_LISTSWSSUTControlAdapter sutControlAdapter = this.Site.GetAdapter<IMS_LISTSWSSUTControlAdapter>(); string absoluteFileUrl = sutControlAdapter.UploadFile(listTitle); Site.Assert.IsTrue( !string.IsNullOrEmpty(absoluteFileUrl), "Upload file to the list {0} should be successful, the file path is [{1}]", listTitle, absoluteFileUrl); // Get Add file item in the document library GetListItemsResponseGetListItemsResult getListItemsForFileItem = null; getListItemsForFileItem = this.listswsAdapter.GetListItems( listId, null, null, null, null, null, null); if (null == getListItemsForFileItem || null == getListItemsForFileItem.listitems || null == getListItemsForFileItem.listitems.data || !getListItemsForFileItem.listitems.data.ItemCount.Equals("1")) { this.Site.Assert.Fail("Upload a file to SUT fail."); } DataTable rowDataOfGetListitem = AdapterHelper.ExtractData(getListItemsForFileItem.listitems.data.Any); // Get the current Folder item id, it is required column in [MS-LISTSWS] string documentItemId = rowDataOfGetListitem.Rows[0]["ows_ID"].ToString(); // add a folder. string uniqueFolderName = TestSuiteHelper.GetUniqueFolderName(); UpdateListItemsUpdates listItemUpdates = new UpdateListItemsUpdates(); listItemUpdates.Batch = new UpdateListItemsUpdatesBatch(); listItemUpdates.Batch.Method = new UpdateListItemsUpdatesBatchMethod[1]; listItemUpdates.Batch.Method[0] = new UpdateListItemsUpdatesBatchMethod(); listItemUpdates.Batch.Method[0].ID = (uint)0; listItemUpdates.Batch.Method[0].Cmd = MethodCmdEnum.New; listItemUpdates.Batch.Method[0].Field = new UpdateListItemsUpdatesBatchMethodField[2]; listItemUpdates.Batch.Method[0].Field[0] = new UpdateListItemsUpdatesBatchMethodField(); listItemUpdates.Batch.Method[0].Field[0].Name = "FSObjType"; listItemUpdates.Batch.Method[0].Field[0].Value = "1"; listItemUpdates.Batch.Method[0].Field[1] = new UpdateListItemsUpdatesBatchMethodField(); listItemUpdates.Batch.Method[0].Field[1].Name = "BaseName"; listItemUpdates.Batch.Method[0].Field[1].Value = uniqueFolderName; UpdateListItemsResponseUpdateListItemsResult updateListResult = null; updateListResult = this.listswsAdapter.UpdateListItems(listId, listItemUpdates); if (null == updateListResult || null == updateListResult.Results || null == updateListResult.Results || updateListResult.Results.Length != 1) { this.Site.Assert.Fail("Could not create a folder to current list[{0}].", listId); } if (null == updateListResult.Results[0].Any) { this.Site.Assert.Fail("Could not get the created folder item[{0}] information.", uniqueFolderName); } DataTable rowDataOfFolderItems = AdapterHelper.ExtractData(updateListResult.Results[0].Any); // Get the current Folder item id, it is required column in [MS-LISTSWS] this.Site.Assert.AreEqual(1, rowDataOfFolderItems.Rows.Count, "Could not get the created folder item detail information"); string folderItemId = rowDataOfFolderItems.Rows[0]["ows_ID"].ToString(); // If R14021 is enable, Protocol SUT is able to return getListResult.List.EnableFolderCreation attribute. // If this attribute is return by SUT and its value is true, then capture R14021 if (Common.IsRequirementEnabled(14021, this.Site)) { GetListResponseGetListResult getListResult = null; getListResult = this.listswsAdapter.GetList(listId); this.Site.CaptureRequirementIfIsTrue( bool.TrueString.Equals(getListResult.List.EnableFolderCreation, StringComparison.OrdinalIgnoreCase), 14021, @"[ListDefinitionCT.EnableFolderCreation: ] [If the attribute is returned by SUT]Implementation does True if folder creation is enabled on the list.(Microsoft SharePoint Foundation 2010 and above follow this behavior.)"); } // Set the EnumViewAttributes to "FilesOnly" value. CamlQueryOptions queryOption = CreateDefaultCamlQueryOptions(); queryOption.QueryOptions.ViewAttributes.Scope = EnumViewAttributes.FilesOnly; GetListItemsResponseGetListItemsResult getListItems = null; getListItems = this.listswsAdapter.GetListItems( listId, null, null, null, null, queryOption, null); if (null == getListItems || null == getListItems.listitems || null == getListItems.listitems.data || null == getListItems.listitems.data.Any) { this.Site.Assert.Fail("Could not get the valid response for GetListItems operation"); } XmlNode[] rowInformation = getListItems.listitems.data.Any; DataTable rowDataOfGtListItems = AdapterHelper.ExtractData(rowInformation); // Verify whether the response contains added folder item var rowItemsOfFolder = from DataRow folderitem in rowDataOfGtListItems.Rows where folderitem["ows_Id"].ToString().Equals(folderItemId, StringComparison.OrdinalIgnoreCase) select folderitem; bool isResultContainedFolderItem = rowItemsOfFolder.Count() > 0; this.Site.Assert.IsFalse(isResultContainedFolderItem, "The Response of GetListItems operation contain a folder type item"); // Verify whether the response contains added document. var rowItemsOfDocument = from DataRow documentitem in rowDataOfGtListItems.Rows where documentitem["ows_Id"].ToString().Equals(documentItemId, StringComparison.OrdinalIgnoreCase) select documentitem; // Because only upload a file, If only one file type item is return and document count equals to 1, capture the R280 this.Site.CaptureRequirementIfAreEqual( 1, rowItemsOfDocument.Count(), 280, @"[In EnumViewAttributes] the FilesOnly option MUST return only the documents and not the folders."); }