/// <summary> /// Get document class value of a specific folder or document. /// </summary> /// <param name="linkId">UNC path of shared folder or document in server.</param> /// <returns>Search command response.</returns> protected SearchResponse SearchCommand(string linkId) { // Initialize a store object SearchStore store = new SearchStore { Name = SearchName.DocumentLibrary.ToString(), Query = new queryType() }; if (linkId != null) { // Give the query values queryTypeEqualTo subQuery = new queryTypeEqualTo { LinkId = string.Empty, Value = linkId }; store.Query.ItemsElementName = new ItemsChoiceType2[] { ItemsChoiceType2.EqualTo }; store.Query.Items = new object[] { subQuery }; } store.Options = new Options1 { ItemsElementName = new ItemsChoiceType6[2] }; store.Options.ItemsElementName[0] = ItemsChoiceType6.UserName; store.Options.ItemsElementName[1] = ItemsChoiceType6.Password; store.Options.Items = new string[2]; store.Options.Items[0] = Common.GetConfigurationPropertyValue("UserName", this.Site); store.Options.Items[1] = Common.GetConfigurationPropertyValue("UserPassword", this.Site); // Create a search command request. SearchRequest searchRequest = Common.CreateSearchRequest(new SearchStore[] { store }); // Get search command response. SearchResponse searchResponse = this.ASDOCAdapter.Search(searchRequest); Site.Assert.AreEqual<HttpStatusCode>(HttpStatusCode.OK, searchResponse.StatusCode, "The call should be successful."); return searchResponse; }
/// <summary> /// Builds a Search request on the Mailbox store by using the specified keyword and folder collection ID /// In general, returns the XML formatted search request as follows: /// <!-- /// <?xml version="1.0" encoding="utf-8"?> /// <Search xmlns="Search" xmlns:airsync="AirSync"> /// <Store> /// <Name>Mailbox</Name> /// <Query> /// <And> /// <airsync:CollectionId>5</airsync:CollectionId> /// <FreeText>Presentation</FreeText> /// </And> /// </Query> /// <Options> /// <RebuildResults /> /// <Range>0-9</Range> /// <DeepTraversal/> /// </Options> /// </Store> /// </Search> /// --> /// </summary> /// <param name="storeName">Specify the store for which to search. Refer to [MS-ASCMD] section 2.2.3.110.2</param> /// <param name="keyword">Specify a string value for which to search. Refer to [MS-ASCMD] section 2.2.3.73</param> /// <param name="collectionId">Specify the folder in which to search. Refer to [MS-ASCMD] section 2.2.3.30.4</param> /// <returns>Returns a SearchRequest instance</returns> internal static SearchRequest CreateSearchRequest(string storeName, string keyword, string collectionId) { if (null == keyword) { throw new ArgumentNullException("keyword", "keyword: Specify the value to search"); } if (null == collectionId) { throw new ArgumentNullException("collectionId", "folderCollectionId: Specify the folder ID to search"); } Request.SearchStore searchStore = new Request.SearchStore { Name = storeName, Options = new Request.Options1() }; Dictionary <Request.ItemsChoiceType6, object> items = new Dictionary <Request.ItemsChoiceType6, object> { { Request.ItemsChoiceType6.DeepTraversal, string.Empty }, { Request.ItemsChoiceType6.RebuildResults, string.Empty }, { Request.ItemsChoiceType6.Range, "0-9" } }; searchStore.Options.Items = items.Values.ToArray <object>(); searchStore.Options.ItemsElementName = items.Keys.ToArray <Request.ItemsChoiceType6>(); // Build up query condition by using the keyword and folder CollectionID Request.queryType queryItem = new Request.queryType { Items = new object[] { collectionId, keyword }, ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText } }; searchStore.Query = new Request.queryType { Items = new object[] { queryItem }, ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And } }; return(Common.CreateSearchRequest(new Request.SearchStore[] { searchStore })); }
/// <summary> /// Builds a Search request on the Mailbox store by using the specified keyword and folder collection ID /// In general, returns the XML formatted search request as follows: /// <!-- /// <?xml version="1.0" encoding="utf-8"?> /// <Search xmlns="Search" xmlns:airsync="AirSync"> /// <Store> /// <Name>Mailbox</Name> /// <Query> /// <And> /// <airsync:CollectionId>5</airsync:CollectionId> /// <FreeText>Presentation</FreeText> /// </And> /// </Query> /// <Options> /// <RebuildResults /> /// <Range>0-9</Range> /// <DeepTraversal/> /// </Options> /// </Store> /// </Search> /// --> /// </summary> /// <param name="storeName">Specify the store for which to search. Refer to [MS-ASCMD] section 2.2.3.110.2.</param> /// <param name="option">Specify a string value for which to search. Refer to [MS-ASCMD] section 2.2.3.73.</param> /// <param name="queryType">Specify the folder in which to search. Refer to [MS-ASCMD] section 2.2.3.30.4.</param> /// <returns>Returns a SearchRequest instance.</returns> internal static SearchRequest CreateSearchRequest(string storeName, Request.Options1 option, Request.queryType queryType) { Request.SearchStore searchStore = new Request.SearchStore { Name = storeName, Options = option, Query = queryType }; return(Common.CreateSearchRequest(new Request.SearchStore[] { searchStore })); }
/// <summary> /// Builds a Search request on the Mailbox store by using the specified keyword and folder collection ID /// In general, returns the XML formatted search request as follows: /// <!-- /// <?xml version="1.0" encoding="utf-8"?> /// <Search xmlns="Search" xmlns:airsync="AirSync"> /// <Store> /// <Name>Mailbox</Name> /// <Query> /// <And> /// <airsync:CollectionId>5</airsync:CollectionId> /// <FreeText>Presentation</FreeText> /// </And> /// </Query> /// <Options> /// <RebuildResults /> /// <Range>0-9</Range> /// <DeepTraversal/> /// </Options> /// </Store> /// </Search> /// --> /// </summary> /// <param name="storeName">Specify the store for which to search. Refer to [MS-ASCMD] section 2.2.3.110.2.</param> /// <param name="option">Specify a string value for which to search. Refer to [MS-ASCMD] section 2.2.3.73.</param> /// <param name="queryType">Specify the folder in which to search. Refer to [MS-ASCMD] section 2.2.3.30.4.</param> /// <returns>Returns a SearchRequest instance.</returns> internal static SearchRequest CreateSearchRequest(string storeName, Request.Options1 option, Request.queryType queryType) { Request.SearchStore searchStore = new Request.SearchStore { Name = storeName, Options = option, Query = queryType }; return Common.CreateSearchRequest(new Request.SearchStore[] { searchStore }); }
/// <summary> /// Builds a Search request on the Mailbox store by using the specified keyword and folder collection ID /// In general, returns the XML formatted search request as follows: /// <!-- /// <?xml version="1.0" encoding="utf-8"?> /// <Search xmlns="Search" xmlns:airsync="AirSync"> /// <Store> /// <Name>Mailbox</Name> /// <Query> /// <And> /// <airsync:CollectionId>5</airsync:CollectionId> /// <FreeText>Presentation</FreeText> /// </And> /// </Query> /// <Options> /// <RebuildResults /> /// <Range>0-9</Range> /// <DeepTraversal/> /// </Options> /// </Store> /// </Search> /// --> /// </summary> /// <param name="storeName">Specify the store for which to search. Refer to [MS-ASCMD] section 2.2.3.110.2</param> /// <param name="keyword">Specify a string value for which to search. Refer to [MS-ASCMD] section 2.2.3.73</param> /// <param name="collectionId">Specify the folder in which to search. Refer to [MS-ASCMD] section 2.2.3.30.4</param> /// <returns>Returns a SearchRequest instance</returns> internal static SearchRequest CreateSearchRequest(string storeName, string keyword, string collectionId) { if (null == keyword) { throw new ArgumentNullException("keyword", "keyword: Specify the value to search"); } if (null == collectionId) { throw new ArgumentNullException("collectionId", "folderCollectionId: Specify the folder ID to search"); } Request.SearchStore searchStore = new Request.SearchStore { Name = storeName, Options = new Request.Options1() }; Dictionary<Request.ItemsChoiceType6, object> items = new Dictionary<Request.ItemsChoiceType6, object> { { Request.ItemsChoiceType6.DeepTraversal, string.Empty }, { Request.ItemsChoiceType6.RebuildResults, string.Empty }, { Request.ItemsChoiceType6.Range, "0-9" } }; searchStore.Options.Items = items.Values.ToArray<object>(); searchStore.Options.ItemsElementName = items.Keys.ToArray<Request.ItemsChoiceType6>(); // Build up query condition by using the keyword and folder CollectionID Request.queryType queryItem = new Request.queryType { Items = new object[] { collectionId, keyword }, ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText } }; searchStore.Query = new Request.queryType { Items = new object[] { queryItem }, ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And } }; return Common.CreateSearchRequest(new Request.SearchStore[] { searchStore }); }
public void MSASCMD_S14_TC15_Search_WithAllClass() { Site.Assume.IsTrue(Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.1" || Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.0", "[In Appendix A: Product Behavior] <14> Section 2.2.3.27.4: The SMS and Notes classes are only available if the MS-ASProtocolVersion header is set to 14.0 [or 14.1]."); #region Create one item in User2 Inbox folder, Calendar folder, Contacts subfolder string searchPrefix = "keyWord" + TestSuiteBase.ClientId; // Respectively create one item in User2 Inbox folder, Calendar folder and Contacts sub-folder this.CreateItemsWithKeyword(searchPrefix); #endregion #region Create Search request with class element Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal, Request.ItemsChoiceType6.RebuildResults }, Items = new object[] { string.Empty, string.Empty } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { this.User2Information.InboxCollectionId, this.User2Information.CalendarCollectionId, this.User2Information.ContactsCollectionId, "Tasks", "Email", "Calendar", "Contacts", "Notes", "SMS", searchPrefix }; #endregion #region Call search command SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); SearchResponse searchResponse = this.CMDAdapter.Search(searchRequest); Site.Assert.AreEqual("1", searchResponse.ResponseData.Response.Store.Status, "If server successfully completed command, server should return status 1"); if (searchResponse.ResponseData.Response.Store.Status != "1" || searchResponse.ResponseData.Response.Store.Result.Length != 3) { searchResponse = this.LoopSearch(searchRequest, 3); } #endregion #region Verify requirements MS-ASCMD_R1322, MS-ASCMD_R920, MS-ASCMD_R5146, MS-ASCMD_R5883 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R920"); // Verify MS-ASCMD requirement: MS-ASCMD_R920 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 920, @"[In Class(Search)] The valid airsync:Class element values are: Tasks, Email, Calendar, Contacts, Notes, SMS<14>."); if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.0") { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5146"); // Verify MS-ASCMD requirement: MS-ASCMD_R5146 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 5146, @"[In Appendix A: Product Behavior] <14> Section 2.2.3.27.4: The SMS and Notes classes are only available if the MS-ASProtocolVersion header is set to 14.0 [or 14.1]."); } if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.1") { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5883"); // Verify MS-ASCMD requirement: MS-ASCMD_R5883 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 5883, @"[In Appendix A: Product Behavior] <14> Section 2.2.3.27.4: The SMS and Notes classes are only available if the MS-ASProtocolVersion header is set to [14.0 or] 14.1."); } bool isAllResultContainClass = false; foreach (Response.SearchResponseStoreResult result in searchResponse.ResponseData.Response.Store.Result) { // Check if every search result contains Class element. isAllResultContainClass = result.Class != null && IsClassSupported(result.Class); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R1322"); // Verify MS-ASCMD requirement: MS-ASCMD_R1322 Site.CaptureRequirementIfIsTrue( isAllResultContainClass, 1322, @"[In Class(Search)] Element Class (Search) in Search command response, the number allowed is 1? (required, 1 per Result element)."); #endregion }
/// <summary> /// Create a Search request using the specified keyword and folder collection ID /// </summary> /// <param name="keyword">Specify a string value for which to search.</param> /// <param name="folderCollectionId">Specify the folder in which to search.</param> /// <returns>A SearchRequest instance</returns> public static SearchRequest CreateSearchRequest(string keyword, string folderCollectionId) { Request.SearchStore searchStore = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { string.Empty, string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.RebuildResults, Request.ItemsChoiceType6.DeepTraversal } } }; // Build up query condition by using the keyword and folder CollectionID Request.queryType queryItem = new Request.queryType { Items = new object[] { folderCollectionId, keyword }, ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText } }; searchStore.Query = new Request.queryType { Items = new object[] { queryItem }, ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And } }; return Common.CreateSearchRequest(new Request.SearchStore[] { searchStore }); }
public void MSASCMD_S14_TC10_Search_MoreThanOneStores() { Site.Assume.IsTrue(Common.IsRequirementEnabled(4535, this.Site), "[In Appendix A: Product Behavior] The implementation does not return a protocol status error in response to such a command request [[more than one Store element in a Search command request is undefined]. (Exchange 2007 and above follow this behavior.)"); #region Create a search request with multiple Store elements. Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { "Email", this.User1Information.InboxCollectionId, "FreeText" }; // Create search request with two store elements SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store, store }); #endregion #region Call Search command SearchResponse searchResponse = this.CMDAdapter.Search(searchRequest); Site.Assert.AreEqual("1", searchResponse.ResponseData.Response.Store.Status, "If server successfully completed command, server should return status 1"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4535"); // Verify MS-ASCMD requirement: MS-ASCMD_R4535 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 4535, @"[In Appendix A: Product Behavior] The implementation does not return a protocol status error in response to such a command request [more than one Store element in a Search command request is undefined]. (Exchange 2007 and above follow this behavior.)"); #endregion }
public void MSASCMD_S14_TC02_Search_MultipleAndElements() { #region Create a search request with multiple And elements. Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And, Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType(), new Request.queryType() } } }; // Create search request with multiple And elements. ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { "Email", this.User1Information.InboxCollectionId, "FreeText" }; SearchRequest invalidSearchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Call method SendStringRequest to send a plain text request. string sendStringRequest = invalidSearchRequest.GetRequestDataSerializedXML(); SendStringResponse response = this.CMDAdapter.SendStringRequest(CommandName.Search, null, sendStringRequest); XmlDocument doc = new XmlDocument(); doc.LoadXml(response.ResponseDataXML); XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable); xnm.AddNamespace("e", "Search"); int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); int counter = 1; XmlNode searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm); while (counter < retryCount && searchStatus != null && searchStatus.InnerXml.Equals("10")) { Thread.Sleep(waitTime); response = this.CMDAdapter.SendStringRequest(CommandName.Search, null, sendStringRequest); doc.LoadXml(response.ResponseDataXML); xnm = new XmlNamespaceManager(doc.NameTable); xnm.AddNamespace("e", "Search"); searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm); counter++; } string status = Common.GetSearchStatusCode(response); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R772"); // Verify MS-ASCMD requirement: MS-ASCMD_R772 Site.CaptureRequirementIfAreEqual<string>( "8", status, 772, @"[In And] If multiple And elements are included in the request, the server responds with a Status element (section 2.2.3.162.12) value of 8 (SearchTooComplex)."); #endregion }
/// <summary> /// Call Search command to find email. /// </summary> /// <param name="collectionId">The CollectionId of the folder to search.</param> /// <param name="freeText">The key words to search.</param> /// <returns>The response of Search command.</returns> protected SearchResponse CallSearchCommand(string collectionId, string freeText) { // Create Search command request. Request.SearchStore[] searchStores = new Request.SearchStore[1]; searchStores[0] = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)searchStores[0].Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)searchStores[0].Query.Items[0]).Items = new object[] { collectionId, freeText }; searchStores[0].Options = new Request.Options1 { Items = new object[] { string.Empty, "0-9", string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.RebuildResults, Request.ItemsChoiceType6.Range, Request.ItemsChoiceType6.DeepTraversal } }; SearchRequest searchRequest = Common.CreateSearchRequest(searchStores); // Call Search command by HTTP POST. string searchString = searchRequest.GetRequestDataSerializedXML(); SendStringResponse searchResponseString = this.HTTPAdapter.HTTPPOST(CommandName.Search, null, searchString); // Convert from SendStringResponse to SearchResponse. SearchResponse searchResponse = new SearchResponse { ResponseDataXML = searchResponseString.ResponseDataXML }; searchResponse.DeserializeResponseData(); return searchResponse; }
public void MSASCMD_S14_TC22_Search_WithDeepTraversal() { #region User1 calls SendMail command to send two emails to user2 string searchPrefix = "keyWord" + TestSuiteBase.ClientId; string emailSubject1 = searchPrefix + Common.GenerateResourceName(Site, "subject1"); string emailSubject2 = searchPrefix + Common.GenerateResourceName(Site, "subject2"); this.SendPlainTextEmail(null, emailSubject1, this.User1Information.UserName, this.User2Information.UserName, null); this.SendPlainTextEmail(null, emailSubject2, this.User1Information.UserName, this.User2Information.UserName, null); #endregion #region User2 move one of emails to new subfolder in Inbox folder. this.SwitchUser(this.User2Information); string emailItemOneServerID = this.GetItemServerIdFromSpecialFolder(this.User2Information.InboxCollectionId, emailSubject1); this.GetItemServerIdFromSpecialFolder(this.User2Information.InboxCollectionId, emailSubject2); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1, emailSubject2); // User2 creates one subfolder in Inbox folder. string folderID = this.CreateFolder((byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate"), this.User2Information.InboxCollectionId); TestSuiteBase.RecordCaseRelativeFolders(this.User2Information, folderID); // User2 moves the email with emailSubject1 into new subfolder. MoveItemsRequest moveItemRequest = TestSuiteBase.CreateMoveItemsRequest(emailItemOneServerID, this.User2Information.InboxCollectionId, folderID); MoveItemsResponse moveItemResponse = this.CMDAdapter.MoveItems(moveItemRequest); Site.Assert.AreEqual(3, int.Parse(moveItemResponse.ResponseData.Response[0].Status), " If MoveItems command executes successful, server should return status 3"); this.GetMailItem(folderID, emailSubject1); TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1); #endregion #region Creates Search request with DeepTraversale element Request.queryType query = new Request.queryType(); string storeName = SearchName.Mailbox.ToString(); Request.Options1 optionWithDeepTraversalAndRebuild = new Request.Options1(); // Create search request query. query.ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }; query.Items = new Request.queryType[] { new Request.queryType() }; ((Request.queryType)query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)query.Items[0]).Items = new object[] { this.User2Information.InboxCollectionId, searchPrefix }; // Create Search option with DeepTraversal and Rebuild. optionWithDeepTraversalAndRebuild.Items = new object[] { string.Empty, string.Empty }; optionWithDeepTraversalAndRebuild.ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal, Request.ItemsChoiceType6.RebuildResults }; Request.SearchStore store = new Request.SearchStore { Name = storeName, Query = query, Options = optionWithDeepTraversalAndRebuild }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Call search command with DeepTraversal element SearchResponse searchResponse = this.CMDAdapter.Search(searchRequest); Site.Assert.AreEqual("1", searchResponse.ResponseData.Response.Store.Status, "If server successfully completed command, server should return status 1"); if (searchResponse.ResponseData.Response.Store.Status != "1" || searchResponse.ResponseData.Response.Store.Result.Length != 2) { searchResponse = this.LoopSearch(searchRequest, 2); } #endregion List<object> subjectInSearchResult = GetElementsFromSearchResponse(searchResponse, Response.ItemsChoiceType6.Subject1); bool resultContainsAllEmail = false; int findEmailCount = 0; for (int listIndex = 0; listIndex < subjectInSearchResult.Count; listIndex++) { string subject = (string)subjectInSearchResult[listIndex]; if (subject.Equals(emailSubject1) || subject.Equals(emailSubject2)) { findEmailCount++; } } if (findEmailCount == 2) { resultContainsAllEmail = true; } #region Verify Requirements MS-ASCMD_R2031, MS-ASCMD_R5856 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2031"); // Verify MS-ASCMD requirement: MS-ASCMD_R2031 Site.CaptureRequirementIfIsTrue( resultContainsAllEmail, 2031, @"[In CollectionId(Search)] If the DeepTraversal element (section 2.2.3.41) is present, it applies to all folders under each airsync:CollectionId element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5856"); // Verify MS-ASCMD requirement: MS-ASCMD_R5856 Site.CaptureRequirementIfIsTrue( resultContainsAllEmail, 5856, @"[In DeepTraversal] [The DeepTraversal element] indicates that the client wants the server to search all subfolders for the folders that are specified in the query."); #endregion }
public void MSASCMD_S14_TC29_Search_MoreThanOneConversationId() { Site.Assume.IsTrue(Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.1" || Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.0", "[In Appendix A: Product Behavior] <23> Section 2.2.3.35.2: The ConversationId element is not supported when the MS-ASProtocolVersion header is set to 12.1."); #region Create a search request with multiple ConversationId elements. string conversationId = Guid.NewGuid().ToString("N"); Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.ConversationId, Request.ItemsChoiceType2.ConversationId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { conversationId, conversationId, "KeyWord" }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Call Search command SearchResponse searchResponse = this.CMDAdapter.Search(searchRequest); #endregion if (Common.IsRequirementEnabled(5815, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5815"); // Verify MS-ASCMD requirement: MS-ASCMD_R5815 Site.CaptureRequirementIfAreNotEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 5815, @"[In Appendix A: Product Behavior] The implementation does return a protocol status error in response to such a command request [more than one ConversationId element in a Search command request]. (Exchange 2007 and above follow this behavior.)"); } }
public void MSASCMD_S14_TC30_Search_TooComplex_Status8_Or() { #region Creates search request with Or element // Create default search request. Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.Or }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { "Email", "KeyWord" }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Calls search command SearchResponse searchResponse = this.CMDAdapter.Search(searchRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5571"); // Test Case verify requirement: MS-ASCMD_R5571 Site.CaptureRequirementIfAreEqual<string>( "8", searchResponse.ResponseData.Response.Store.Status, 5571, @"[In Or] If the Or element is included in a Search command request, the server responds with a Status element (section 2.2.3.162.12) value of 8 (SearchTooComplex)."); }
public void MSASCMD_S14_TC28_Search_CaseInsensitiveMatch() { #region User1 calls SendMail command to send 2 email messages to user2. string upperCaseSearchKeyword = "KEYWORD" + TestSuiteBase.ClientId; uint mailIndex = 1; string emailSubject1 = upperCaseSearchKeyword + Common.GenerateResourceName(Site, "search", mailIndex); SendMailResponse responseSendMail = this.SendPlainTextEmail(null, emailSubject1, this.User1Information.UserName, this.User2Information.UserName, null); Site.Assert.AreEqual(string.Empty, responseSendMail.ResponseDataXML, "If SendMail command executes successfully, server should return empty xml data"); mailIndex++; string emailSubject2 = upperCaseSearchKeyword + Common.GenerateResourceName(Site, "search", mailIndex); SendMailResponse responseSendMail2 = this.SendPlainTextEmail(null, emailSubject2, this.User1Information.UserName, this.User2Information.UserName, null); Site.Assert.AreEqual(string.Empty, responseSendMail2.ResponseDataXML, "If SendMail command executes successfully, server should return empty xml data"); #endregion #region Sync user2 mailbox changes // Switch to user2 mailbox this.SwitchUser(this.User2Information); this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject1); this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject2); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1, emailSubject2); #endregion #region Create search request with low case search prefix Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { "0-0", string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.Range, Request.ItemsChoiceType6.RebuildResults } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; // Search with low case search key word. ((Request.queryType)store.Query.Items[0]).Items = new object[] { this.User2Information.InboxCollectionId, upperCaseSearchKeyword.ToLower(System.Globalization.CultureInfo.InvariantCulture) }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Call search command SearchResponse searchResponse = this.LoopSearch(searchRequest, 2); #endregion #region Verify Requirements MS-ASCMD_R3729, MS-ASCMD_R3699 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3729"); // Verify MS-ASCMD requirement: MS-ASCMD_R3729 Site.CaptureRequirementIfIsTrue( searchResponse.ResponseData.Response.Store.Result.Length == 1 && Convert.ToInt32(searchResponse.ResponseData.Response.Store.Total) >= 2, 3729, @"[In Range(Search)] A Range element value of 0-0 indicates 1 item."); string subjectInSearchResult = (string)GetItemFromSearchResult(searchResponse.ResponseData.Response.Store.Result[0], Response.ItemsChoiceType6.Subject1); // If search use lower case search keyword get the correct result, then MS-ASCMD_R3699 is verified. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3699"); // Verify MS-ASCMD requirement: MS-ASCMD_R3699 Site.CaptureRequirementIfIsTrue( subjectInSearchResult.Equals(emailSubject1) || subjectInSearchResult.Equals(emailSubject2), 3699, @"[In Query] Search comparisons are performed by using case-insensitive matching."); #endregion }
public void MSASCMD_S14_TC27_Search_TooComplex_Status8_ConversationId() { Site.Assume.IsTrue(Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.1") || Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0"), "The ConversationId element is not supported when the MS-ASProtocolVersion header is set to 12.1"); #region Create a default search request // Create default search request. Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { "0-0", string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.Range, Request.ItemsChoiceType6.RebuildResults } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { this.User1Information.InboxCollectionId }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Create invalid search request with conversationId element outside of And element string conversationIdElement = "<ConversationId><![CDATA[ BBA4726D4399D44C83297D4BD904ED2D]]></ConversationId>"; // Insert conversationID element before And element. string originalXmlRequest = searchRequest.GetRequestDataSerializedXML(); // Insert element before tag string invalidSearchRequest = originalXmlRequest.Insert(originalXmlRequest.IndexOf("<And", StringComparison.OrdinalIgnoreCase), conversationIdElement); #endregion #region Call method SendStringRequest to send a plain text request. SendStringResponse response = this.CMDAdapter.SendStringRequest(CommandName.Search, null, invalidSearchRequest); XmlDocument doc = new XmlDocument(); doc.LoadXml(response.ResponseDataXML); XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable); xnm.AddNamespace("e", "Search"); int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); int counter = 1; XmlNode searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm); while (counter < retryCount && searchStatus != null && searchStatus.InnerXml.Equals("10")) { Thread.Sleep(waitTime); response = this.CMDAdapter.SendStringRequest(CommandName.Search, null, invalidSearchRequest); doc.LoadXml(response.ResponseDataXML); xnm = new XmlNamespaceManager(doc.NameTable); xnm.AddNamespace("e", "Search"); searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm); counter++; } string status = Common.GetSearchStatusCode(response); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2086"); // Verify MS-ASCMD requirement: MS-ASCMD_R2086 Site.CaptureRequirementIfAreEqual<string>( "8", status, 2086, @"[In ConversationId(Search)] If the ConversationId element is included as a child of any element other than the And element, the server responds with a Status element (section 2.2.3.162.12) value of 8 (SearchTooComplex)."); #endregion }
public void MSASCMD_S14_TC23_Search_WithoutDeepTraversal() { #region User1 calls SendMail command to send two emails to user2 string searchPrefix = "keyWord" + TestSuiteBase.ClientId; string emailSubject1 = searchPrefix + Common.GenerateResourceName(Site, "subject1"); string emailSubject2 = searchPrefix + Common.GenerateResourceName(Site, "subject2"); this.SendPlainTextEmail(null, emailSubject1, this.User1Information.UserName, this.User2Information.UserName, null); this.SendPlainTextEmail(null, emailSubject2, this.User1Information.UserName, this.User2Information.UserName, null); #endregion #region User2 moves one of the emails to new subfolder in Inbox folder. this.SwitchUser(this.User2Information); string emailItemOneServerID = this.GetItemServerIdFromSpecialFolder(this.User2Information.InboxCollectionId, emailSubject1); this.GetItemServerIdFromSpecialFolder(this.User2Information.InboxCollectionId, emailSubject2); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1, emailSubject2); // User2 creates one subfolder in Inbox folder. string folderID = this.CreateFolder((byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate"), this.User2Information.InboxCollectionId); this.SyncChanges(folderID); TestSuiteBase.RecordCaseRelativeFolders(this.User2Information, folderID); // User2 moves the email with emailSubject1 into new subfolder. MoveItemsRequest moveItemRequest = TestSuiteBase.CreateMoveItemsRequest(emailItemOneServerID, this.User2Information.InboxCollectionId, folderID); MoveItemsResponse moveItemResponse = this.CMDAdapter.MoveItems(moveItemRequest); Site.Assert.AreEqual(3, int.Parse(moveItemResponse.ResponseData.Response[0].Status), " If MoveItems command executes successfully, server should return status 3"); this.GetMailItem(folderID, emailSubject1); TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1); #endregion #region Creates Search request without DeepTraversale element Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.RebuildResults } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { this.User2Information.InboxCollectionId, searchPrefix }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Call search command without DeepTraversal element SearchResponse searchResponseWithOutDeepTraversal = this.LoopSearch(searchRequest); #endregion List<object> subjectInSearchResult = GetElementsFromSearchResponse(searchResponseWithOutDeepTraversal, Response.ItemsChoiceType6.Subject1); bool resultCotainsEmail1 = false; bool resultCotainsEmail2 = false; foreach (object result in subjectInSearchResult) { string subject = (string)result; if (subject.Equals(emailSubject1)) { resultCotainsEmail1 = true; } else if (subject.Equals(emailSubject2)) { resultCotainsEmail2 = true; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2146"); // Verify MS-ASCMD requirement: MS-ASCMD_R2146 Site.CaptureRequirementIfIsTrue( !resultCotainsEmail1 && resultCotainsEmail2, 2146, @"[In DeepTraversal] If the DeepTraversal element is not present, the subfolders are not searched."); }
public void MSASCMD_S14_TC16_Search_WithoutNoteAndSmsClass() { Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Notes, SMS class is not supported in ProtocolVersion 12.1"); #region Create one item in User2 Inbox folder, Calendar folder, contacts sub folder string searchPrefix = "keyWord" + TestSuiteBase.ClientId; // Respectively create one item in User2 Inbox folder, Calendar folder and Contacts subfolder. this.CreateItemsWithKeyword(searchPrefix); #endregion #region Create Search request with class element Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal, Request.ItemsChoiceType6.RebuildResults }, Items = new object[] { string.Empty, string.Empty } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { this.User2Information.InboxCollectionId, this.User2Information.CalendarCollectionId, this.User2Information.ContactsCollectionId, "Tasks", "Email", "Calendar", "Contacts", searchPrefix }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Call search command SearchResponse searchResponse = this.CMDAdapter.Search(searchRequest); Site.Assert.AreEqual("1", searchResponse.ResponseData.Response.Store.Status, "If server successfully completed command, server should return status 1"); if (searchResponse.ResponseData.Response.Store.Status != "1" || searchResponse.ResponseData.Response.Store.Result.Length != 3) { searchResponse = this.LoopSearch(searchRequest); } #endregion #region Verify requirements MS-ASCMD_R5841, MS-ASCMD_R5145, MS-ASCMD_R5840, MS-ASCMD_R5842 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5841"); // Verify MS-ASCMD requirement: MS-ASCMD_R5841 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 5841, @"[In Appendix A: Product Behavior] <14> Section 2.2.3.27.4: The following classes are supported for mailbox searches when the MS-ASProtocolVersion header is set to 12.1: [Email, Calendar,] Contacts [, Tasks]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5145"); // Verify MS-ASCMD requirement: MS-ASCMD_R5145 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 5145, @"[In Appendix A: Product Behavior] <14> Section 2.2.3.27.4: The following classes are supported for mailbox searches when the MS-ASProtocolVersion header is set to 12.1: Email [, Calendar, Contacts, Tasks]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5840"); // Verify MS-ASCMD requirement: MS-ASCMD_R5840 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 5840, @"[In Appendix A: Product Behavior] <14> Section 2.2.3.27.4: The following classes are supported for mailbox searches when the MS-ASProtocolVersion header is set to 12.1: [Email,] Calendar, [Contacts, Tasks]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5842"); // Verify MS-ASCMD requirement: MS-ASCMD_R5842 Site.CaptureRequirementIfAreEqual<string>( "1", searchResponse.ResponseData.Response.Store.Status, 5842, @"[In Appendix A: Product Behavior] <14> Section 2.2.3.27.4: The following classes are supported for mailbox searches when the MS-ASProtocolVersion header is set to 12.1: [Email, Calendar, Contacts,] Tasks."); #endregion }
/// <summary> /// Create one search request with default value. /// </summary> /// <returns>Return a SearchRequest instance.</returns> private SearchRequest CreateDefaultSearchRequest() { Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { "Email", this.User1Information.InboxCollectionId, "FreeText" }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); return searchRequest; }
/// <summary> /// Create search document library request /// </summary> /// <param name="pointTo">Point to specified folder or item.</param> /// <param name="userName">The user name need to access the resource.</param> /// <param name="userPassword">The user password.</param> /// <returns>The search request.</returns> private static SearchRequest CreateSearchDocumentLibraryRequest(string pointTo, string userName, string userPassword) { Request.SearchStore store = new Request.SearchStore { Name = SearchName.DocumentLibrary.ToString(), Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.EqualTo }, Items = new Request.queryTypeEqualTo[] { new Request.queryTypeEqualTo { LinkId = string.Empty, Value = pointTo } } }, Options = new Request.Options1 { ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.UserName, Request.ItemsChoiceType6.Password }, Items = new object[] { userName, userPassword } } }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); return searchRequest; }
public void MSASCMD_S14_TC17_Search_WithoutClass() { #region Create one item in User2 Inbox folder, Calendar folder and Contacts subfolder string searchPrefix = "keyWord" + TestSuiteBase.ClientId; // Respectively create one item in User2 Inbox folder, Calendar folder and Contacts subfolder. this.CreateItemsWithKeyword(searchPrefix); #endregion #region Create Search request without class element Request.SearchStore store = new Request.SearchStore { Name = SearchName.Mailbox.ToString(), Options = new Request.Options1 { Items = new object[] { string.Empty, string.Empty }, ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal, Request.ItemsChoiceType6.RebuildResults } }, Query = new Request.queryType { ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }, Items = new Request.queryType[] { new Request.queryType() } } }; ((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText }; ((Request.queryType)store.Query.Items[0]).Items = new object[] { this.User2Information.InboxCollectionId, this.User2Information.CalendarCollectionId, this.User2Information.ContactsCollectionId, searchPrefix }; SearchRequest searchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store }); #endregion #region Call search command SearchResponse searchResponse = this.LoopSearch(searchRequest); #endregion bool isClassInResultIsServerSupported = false; // Check if every search result contains Class element and the Class element is server supported. foreach (Response.SearchResponseStoreResult result in searchResponse.ResponseData.Response.Store.Result) { // Check if every search result contains Class element. if (result.Class != null) { isClassInResultIsServerSupported = IsClassSupported(result.Class); } else { isClassInResultIsServerSupported = false; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R922"); // Verify MS-ASCMD requirement: MS-ASCMD_R922 Site.CaptureRequirementIfIsTrue( isClassInResultIsServerSupported, 922, @"[In Class(Search)] If one or more airsync:Class elements are not included in the Search request, the server will return all supported classes."); }