/// <summary> /// Creates Task items in the Exchange store /// </summary> /// <param name="createItemRequest">Specifies a request to create Task items on the server.</param> /// <returns>A response to this operation request.</returns> public CreateItemResponseType CreateItem(CreateItemType createItemRequest) { CreateItemResponseType createItemResponse = this.exchangeServiceBinding.CreateItem(createItemRequest); Site.Assert.IsNotNull(createItemResponse, "If the operation is successful, the response should not be null."); // Verify the create item operation. this.VerifyCreateItemOperation(createItemResponse, this.exchangeServiceBinding.IsSchemaValidated); // Verify Soap version requirements. this.VerifySoapVersion(); // Verify transport requirements. this.VerifyTransportType(); return createItemResponse; }
/// <summary> /// Create contact item on the server. /// </summary> /// <param name="createItemRequest">The request of CreateItem operation.</param> /// <returns>A response to CreateItem operation request.</returns> public CreateItemResponseType CreateItem(CreateItemType createItemRequest) { CreateItemResponseType createItemResponse = this.exchangeServiceBinding.CreateItem(createItemRequest); #region Verify CreateItem operation requirements this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCreateContactItem(this.exchangeServiceBinding.IsSchemaValidated); #endregion return createItemResponse; }
/// <remarks/> public void CreateItemAsync(CreateItemType CreateItem1) { this.CreateItemAsync(CreateItem1, null); }
public void MSOXWSMSG_S01_TC06_GetMessageWithIncludeMimeContent() { #region Create a message #region Define a CreateItem request CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the subject of message. Subject = this.Subject, } } }, }; #endregion CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); #endregion #region Get the created message via itemIdType in above steps #region Send the GetItem requst which the IncludeMimeContent is set true. GetItemType getItemRequest = new GetItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, IncludeMimeContent = true, IncludeMimeContentSpecified = true, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); MessageType message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21188"); this.Site.CaptureRequirementIfIsNotNull( message.MimeContent, "MS-OXWSCDATA", 21188, @"[In t:ItemResponseShapeType Complex Type] [IncludeMimeContent is] True, specifies the MIME content of an item is returned in a response."); #endregion #region Send the GetItem requst which the IncludeMimeContent is set false. getItemRequest.ItemShape.IncludeMimeContent = false; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21189"); this.Site.CaptureRequirementIfIsNull( message.MimeContent, "MS-OXWSCDATA", 21189, @"[In t:ItemResponseShapeType Complex Type] otherwise [IncludeMimeContent is] false, specifies [the MIME content of an item is not returned in a response]."); #endregion #endregion #region Delete the message created DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion }
public void MSOXWSCONT_S01_TC11_VerifyErrorCannotCreateContactInNonContactFolder() { #region Step 1:Create the contact item. // Call CreateItem operation. ContactItemType item = this.BuildContactItemWithRequiredProperties(); CreateItemType createItemRequest = new CreateItemType(); #region Config the contact item createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ContactItemType[1]; // Create a contact item without optional elements. createItemRequest.Items.Items[0] = item; // Configure the SavedItemFolderId of CreateItem request to specify that the created item is saved under which folder. createItemRequest.SavedItemFolderId = new TargetFolderIdType() { Item = new DistinguishedFolderIdType() { Id = DistinguishedFolderIdNameType.inbox, } }; #endregion // Call CreateItem operation. CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest); this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorCannotCreateContactInNonContactFolder, createItemResponse.ResponseMessages.Items[0].ResponseCode, 301001, @"[In CreateItem] tns:CreateItemSoapIn: The contact (2) item MUST be created in a Contacts folder, or ErrorCannotCreateContactInNonContactFolder ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion }
/// <summary> /// Creates items on the server. /// </summary> /// <param name="createItemRequest">Specify the request for CreateItem operation.</param> /// <returns>The response to this operation request.</returns> public CreateItemResponseType CreateItem(CreateItemType createItemRequest) { if (createItemRequest == null) { throw new ArgumentException("The CreateItem request should not be null."); } // Send the request and get the response. CreateItemResponseType response = this.exchangeServiceBinding.CreateItem(createItemRequest); return response; }
public void MSOXWSMSG_S01_TC08_GetMessageWithBodyTypeAndAdditionProperties() { #region Create a message. #region Define a CreateItem request CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the subject of message. Subject = this.Subject, Body = new BodyType() { BodyType1 = BodyTypeType.HTML, Value = "<html><body><b>Bold</b>test</body></html>" } } } }, }; #endregion CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); #endregion #region Get the created message via itemIdType in above steps #region Send the GetItem requst which the BodyType element is set to text. GetItemType getItemRequest = new GetItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, BodyType = BodyTypeResponseType.Text, BodyTypeSpecified = true, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); MessageType message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1190"); this.Site.CaptureRequirementIfAreEqual<BodyTypeType>( BodyTypeType.Text, message.Body.BodyType1, "MS-OXWSCDATA", 1190, @"[In t:ItemResponseShapeType Complex Type] The element ""BodyType"" with type ""t:BodyTypeResponseType(section 2.2.3.1)"" specifies the requested body text format for the Body property that is returned in a response."); #endregion #region Send the GetItem requst which the BaseShape element is set to IdOnly and addition the subject property. getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.IdOnly; getItemRequest.ItemShape.AdditionalProperties = new BasePathToElementType[] { new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemSubject, } }; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1197"); this.Site.CaptureRequirementIfIsTrue( string.IsNullOrEmpty(message.Subject) == false, "MS-OXWSCDATA", 1197, @"[In t:ItemResponseShapeType Complex Type] The element ""AdditionalProperties"" with type ""t:NonEmptyArrayOfPathsToElementType"" specifies a set of requested additional properties to return in a response."); #endregion #endregion #region Delete the message created DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion }
public void MSOXWSCORE_S04_TC24_DeleteItemWithSuppressReadReceipts() { Site.Assume.IsTrue(Common.IsRequirementEnabled(2311, this.Site), "Exchange 2007, Exchange 2010, and the initial release of Exchange 2013 do not support the SuppressReadReceipts attribute."); #region Send an email with setting IsReadReceiptRequested to true. MessageType message = new MessageType(); message.IsReadReceiptRequestedSpecified = true; message.IsReadReceiptRequested = true; message.ToRecipients = new EmailAddressType[1]; EmailAddressType recipient = new EmailAddressType(); recipient.EmailAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); message.ToRecipients[0] = recipient; message.From = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) } }; CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { message }; createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 1); createItemRequest.MessageDisposition = MessageDispositionType.SendOnly; createItemRequest.MessageDispositionSpecified = true; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Find the email in receiver's inbox. ItemIdType[] findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User2"); Site.Assert.IsNotNull(findItemIds, "The receiver should receive the email."); #endregion #region Delete the found email with setting SuppressReadReceipts to true. DeleteItemType deleteItemRequest = new DeleteItemType(); deleteItemRequest.ItemIds = findItemIds; deleteItemRequest.DeleteType = DisposalType.HardDelete; deleteItemRequest.SuppressReadReceiptsSpecified = true; deleteItemRequest.SuppressReadReceipts = true; DeleteItemResponseType deleteItemResponse = this.COREAdapter.DeleteItem(deleteItemRequest); Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User1"); Site.Assert.IsNull(findItemIds, "The read receipt email should not be received if receiver delete the email with setting SuppressReadReceipts to true."); #endregion #region Send an email with setting IsReadReceiptRequested to true. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 2); createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Find the email in receiver's inbox. findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User2"); Site.Assert.IsNotNull(findItemIds, "The receiver should receive the email."); #endregion #region Delete the found email with setting SuppressReadReceipts to false. deleteItemRequest.ItemIds = findItemIds; deleteItemRequest.SuppressReadReceipts = false; deleteItemResponse = this.COREAdapter.DeleteItem(deleteItemRequest); Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User1"); Site.Assert.AreEqual<int>(1, findItemIds.Length, "The read receipt email should be received if receiver delete the email with setting SuppressReadReceipts to false."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2311"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2311 // This requirement can be captured directly after above steps. this.Site.CaptureRequirement( 2311, @"[In Appendix C: Product Behavior] Implementation does support the SuppressReadReceipts attribute which specifies whether read receipts are suppressed. (Exchange 2013 SP1 and above follow this behavior.)"); #endregion }
public void MSOXWSCORE_S04_TC25_UpdateItemWithSuppressReadReceipts() { Site.Assume.IsTrue(Common.IsRequirementEnabled(2315, this.Site), "Exchange 2007, Exchange 2010, and the initial release of Exchange 2013 do not support the SuppressReadReceipts attribute."); #region Send an email with setting IsReadReceiptRequested to true. MessageType message = new MessageType(); message.IsReadReceiptRequestedSpecified = true; message.IsReadReceiptRequested = true; message.ToRecipients = new EmailAddressType[1]; EmailAddressType recipient = new EmailAddressType(); recipient.EmailAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); message.ToRecipients[0] = recipient; message.From = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) } }; CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { message }; createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 1); createItemRequest.MessageDisposition = MessageDispositionType.SendOnly; createItemRequest.MessageDispositionSpecified = true; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Find the email in receiver's inbox. ItemIdType[] findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User2"); Site.Assert.IsNotNull(findItemIds, "The receiver should receive the email."); #endregion #region Update the found email with setting SuppressReadReceipts to true. ItemChangeType[] itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); itemChanges[0].Item = findItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItemFiled = new SetItemFieldType(); setItemFiled.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.messageIsRead }; setItemFiled.Item1 = new MessageType() { IsRead = true, IsReadSpecified = true }; itemChanges[0].Updates[0] = setItemFiled; UpdateItemType updateItemType = new UpdateItemType(); updateItemType.ItemChanges = itemChanges; updateItemType.ConflictResolution = ConflictResolutionType.AutoResolve; updateItemType.MessageDisposition = MessageDispositionType.SaveOnly; updateItemType.MessageDispositionSpecified = true; updateItemType.SuppressReadReceipts = true; updateItemType.SuppressReadReceiptsSpecified = true; UpdateItemResponseType updateItemResponse = this.COREAdapter.UpdateItem(updateItemType); Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User1"); Site.Assert.IsNull(findItemIds, "The read receipt email should not be received if receiver update the email with setting SuppressReadReceipts to true."); List<string> subjects = new List<string>(); subjects.Add(createItemRequest.Items.Items[0].Subject); this.ExistItemIds.Clear(); #endregion #region Send an email with setting IsReadReceiptRequested to true. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 2); createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Find the email in receiver's inbox. findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User2"); Site.Assert.IsNotNull(findItemIds, "The receiver should receive the email."); #endregion #region Update the found email with setting SuppressReadReceipts to false. updateItemType.ItemChanges[0].Item = findItemIds[0]; updateItemType.SuppressReadReceipts = false; updateItemResponse = this.COREAdapter.UpdateItem(updateItemType); Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User1"); Site.Assert.AreEqual<int>(1, findItemIds.Length, "The read receipt email should not be received if receiver update the email with setting SuppressReadReceipts to true."); subjects.Add(createItemRequest.Items.Items[0].Subject); this.ExistItemIds.Clear(); this.ExistItemIds.Add(findItemIds[0]); this.CleanItemsSentOut(subjects.ToArray()); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2315"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2315 // This requirement can be captured directly after above steps. this.Site.CaptureRequirement( 2315, @"[In Appendix C: Product Behavior] Implementation does support the SuppressReadReceipts attribute specifies whether read receipts are suppressed. (<102> Section 3.1.4.9.3.2: This attribute [SuppressReadReceipts] was introduced in Exchange 2013 SP1.)"); #endregion }
public void MSOXWSCORE_S04_TC22_VerifyItemWithEntityExtractionResult() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1708, this.Site), "Exchange 2007 and Exchange 2010 do not support the EntityExtractionResultType complex type."); #region Step 1: Create message with specific body. // Define the specific elements' values. string meetingSuggestions = "Let's meet for business discussion, from 2:00pm to 2:30pm, December 15th, 2012."; string address = "1234 Main Street, Redmond, WA 07722"; string taskSuggestions = "Please update the spreadsheet by today."; string phoneNumbers = "(235) 555-0110"; string phoneNumberType = "Home"; string businessName = "Department of Revenue Services"; string contactDisplayName = TestSuiteHelper.ContactString; string emailAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); string url = Common.GetConfigurationPropertyValue("ServiceUrl", this.Site); string userEmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); // Define the MessageType item which will be created. MessageType[] messages = new MessageType[] { new MessageType() }; messages[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); EmailAddressType email = new EmailAddressType(); email.EmailAddress = userEmailAddress; messages[0].ToRecipients = new EmailAddressType[1]; messages[0].ToRecipients[0] = email; messages[0].Body = new BodyType(); messages[0].Body.Value = string.Format( "{0} {1} Any problems, contact with {2} from {3}, his {4} phone number is {5}, his email is {6}, his blog is {7} and his address is {8}", meetingSuggestions, taskSuggestions, contactDisplayName, businessName, phoneNumberType, phoneNumbers, emailAddress, url, address); // Define the request of CreateItem operation. CreateItemType requestItem = new CreateItemType(); requestItem.MessageDispositionSpecified = true; requestItem.MessageDisposition = MessageDispositionType.SendOnly; requestItem.Items = new NonEmptyArrayOfAllItemsType(); requestItem.Items.Items = messages; // Call the CreateItem operation. CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(requestItem); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Step 2: Find the message in the inbox folder of User1. // Find the received item in the Inbox folder. ItemIdType[] foundItems = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, messages[0].Subject, "User1"); // The result of FindItemsInFolder should not be null. Site.Assert.IsNotNull( foundItems, "The result of FindItemsInFolder should not be null."); // One item should be returned. Site.Assert.AreEqual<int>( 1, foundItems.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, foundItems.GetLength(0)); #endregion #region Step 3: Get the message. // Get information from the found items. GetItemResponseType getItemResponse = this.CallGetItemOperation(foundItems); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); // Check whether the child elements of EntityExtractionResultType have been returned successfully. ItemInfoResponseMessageType getItems = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1325"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1325 // The schema is validated and InternetMessageHeaders is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( getItems.Items.Items[0].InternetMessageHeaders, 1325, @"[In t:ItemType Complex Type] The type of InternetMessageHeaders is t:NonEmptyArrayOfInternetHeadersType (section 2.2.4.12)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R122"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R122 // The schema is validated and InternetMessageHeaders is not null, so this requirement can be captured. this.Site.CaptureRequirement( 122, @"[In t:NonEmptyArrayOfInternetHeadersType Complex Type] The type [NonEmptyArrayOfInternetHeadersType] is defined as follow: <xs:complexType name=""NonEmptyArrayOfInternetHeadersType""> <xs:sequence> <xs:element name=""InternetMessageHeader"" type=""t:InternetHeaderType"" maxOccurs=""unbounded"" /> </xs:sequence> </xs:complexType>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R20301"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R20301 // MS-OXWSCORE_R1325 is captured, this requirement can be captured directly. this.Site.CaptureRequirement( 20301, @"[In t:ItemType Complex Type] It [InternetMessageHeaders] can be retrieved by GetItem (section 3.1.4.4) operation."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1367"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1367 // The schema is validated and InternetMessageHeaders is not null, so this requirement can be captured. this.Site.CaptureRequirement( 1367, @"[In t:NonEmptyArrayOfInternetHeadersType Complex Type] The type of InternetMessageHeader is t:InternetHeaderType([MS-OXWSCDATA] section 2.2.4.35)."); foreach (InternetHeaderType internetMessageHeader in getItems.Items.Items[0].InternetMessageHeaders) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1674"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1674 // The schema is validated and the internetMessageHeader is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( internetMessageHeader, "MS-OXWSCDATA", 1674, @"[In t:InternetHeaderType Complex Type] The attribute ""HeaderName"" is ""xs:string"" type."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R88"); this.Site.Log.Add(LogEntryKind.Debug, "The HeaderName should not be null, actual {0}.", internetMessageHeader.HeaderName); this.Site.Log.Add(LogEntryKind.Debug, "The Value should not be null, actual {0}.", internetMessageHeader.Value); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R88 // The schema is validated and the child elements in internetMessageHeader are not null, so this requirement can be captured. bool isVerifiedR88 = internetMessageHeader.HeaderName != null && internetMessageHeader.Value != null; this.Site.CaptureRequirementIfIsTrue( isVerifiedR88, 88, @"[In t:ItemType Complex Type] [The element ""InternetMessageHeaders""] Specifies an array of the type InternetHeaderType that represents the collection of all Internet message headers that are contained in an item in a mailbox."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R124"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R124 this.Site.CaptureRequirement( 124, @"[In t:NonEmptyArrayOfInternetHeadersType Complex Type] [The element ""InternetMessageHeader""] Specifies a single Internet message header."); } EntityExtractionResultType entityExtractionResult = getItems.Items.Items[0].EntityExtractionResult; // Verify EntityExtractionResultType structure. this.VerifyEntityExtractionResultType(entityExtractionResult); // Verify ArrayOfAddressEntitiesType structure. this.VerifyArrayOfAddressEntitiesType(entityExtractionResult.Addresses, address); // Verify ArrayOfMeetingSuggestionsType structure. // "2:00pm, December 15th, 2012" is supposed to be "2012/12/15 14:00:00" in dataTime type. // "2:30pm, December 15th, 2012" is supposed to be "2012/12/15 14:30:00" in dataTime type. this.VerifyArrayOfMeetingSuggestionsType(entityExtractionResult.MeetingSuggestions, meetingSuggestions, DateTime.Parse("2012/12/15 14:00:00"), DateTime.Parse("2012/12/15 14:30:00"), Common.GetConfigurationPropertyValue("User1Name", this.Site), userEmailAddress); // Verify ArrayOfTaskSuggestionsType structure. this.VerifyArrayOfTaskSuggestionsType(entityExtractionResult.TaskSuggestions, taskSuggestions, Common.GetConfigurationPropertyValue("User1Name", this.Site), userEmailAddress); // Verify ArrayOfEmailAddressEntitiesType structure. this.VerifyArrayOfEmailAddressEntitiesType(entityExtractionResult.EmailAddresses, emailAddress); // Verify ArrayOfContactsType structure. Uri uri = new Uri(url); this.VerifyArrayOfContactsType(entityExtractionResult.Contacts, contactDisplayName, businessName, uri, phoneNumbers, phoneNumberType, emailAddress, address); // Verify ArrayOfUrlEntitiesType structure. this.VerifyArrayOfUrlEntitiesType(entityExtractionResult.Urls, uri); // Verify ArrayOfPhoneEntitiesType structure. this.VerifyArrayOfPhoneEntitiesType(entityExtractionResult.PhoneNumbers, phoneNumbers, phoneNumberType); #endregion }
public void MSOXWSCORE_S04_TC23_VerifyPublicFolderItem() { FolderIdType folderId = null; FindFolderType findRequest = new FindFolderType(); findRequest.FolderShape = new FolderResponseShapeType(); findRequest.FolderShape.BaseShape = DefaultShapeNamesType.AllProperties; DistinguishedFolderIdType id = new DistinguishedFolderIdType(); id.Id = DistinguishedFolderIdNameType.publicfoldersroot; findRequest.ParentFolderIds = new DistinguishedFolderIdType[] { id }; findRequest.Traversal = FolderQueryTraversalType.Shallow; BaseFolderType[] folders = null; FindFolderResponseType findFolderResponse = this.SRCHAdapter.FindFolder(findRequest); FindFolderResponseMessageType findFolderResponseMessageType = new FindFolderResponseMessageType(); if (findFolderResponse != null && findFolderResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success) { findFolderResponseMessageType = findFolderResponse.ResponseMessages.Items[0] as FindFolderResponseMessageType; folders = findFolderResponseMessageType.RootFolder.Folders; foreach (BaseFolderType folder in folders) { if (folder.DisplayName.Equals(Common.GetConfigurationPropertyValue("PublicFolderName", this.Site))) { folderId = folder.FolderId; } } } Site.Assert.IsNotNull( folderId, "The destination public folder {0} in should exist!", Common.GetConfigurationPropertyValue("PublicFolderName", this.Site)); MessageType message = new MessageType(); MessageType[] items = new MessageType[] { message }; CreateItemType requestItem = new CreateItemType(); requestItem.MessageDispositionSpecified = true; requestItem.MessageDisposition = MessageDispositionType.SaveOnly; requestItem.Items = new NonEmptyArrayOfAllItemsType(); requestItem.Items.Items = items; requestItem.SavedItemFolderId = new TargetFolderIdType(); requestItem.SavedItemFolderId.Item = folderId; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(requestItem); Common.CheckOperationSuccess(createItemResponse, 1, this.Site); ItemInfoResponseMessageType itemInfo = (ItemInfoResponseMessageType)createItemResponse.ResponseMessages.Items[0]; ItemIdId itemId = this.ITEMIDAdapter.ParseItemId(itemInfo.Items.Items[0].ItemId); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSITEMID_R62"); // Verify MS-OXWSITEMID requirement: MS-OXWSITEMID_R62 Site.CaptureRequirementIfAreEqual<IdStorageType>( IdStorageType.PublicFolderItem, itemId.StorageType, "MS-OXWSITEMID", 62, @"[In Id Storage Type (byte)] Its [Id Storage Type's] value maps to the following enumeration value. /// <summary> /// Indicates which type of storage is used for the item/folder represented by this Id. /// </summary> internal enum IdStorageType : byte { [ /// <summary> /// The Id represents an item or folder in a mailbox and /// it contains a primary SMTP address. /// </summary> MailboxItemSmtpAddressBased = 0, /// <summary> /// The Id represents a folder in a PublicFolder store. /// </summary> PublicFolder = 1,] /// <summary> /// The Id represents an item in a PublicFolder store. /// </summary> PublicFolderItem = 2, [ /// <summary> /// The Id represents an item or folder in a mailbox and contains a mailbox GUID. /// </summary> MailboxItemMailboxGuidBased = 3, /// <summary> /// The Id represents a conversation in a mailbox and contains a mailbox GUID. /// </summary> ConversationIdMailboxGuidBased = 4, /// <summary> /// The Id represents (by objectGuid) an object in the Active Directory. /// </summary> ActiveDirectoryObject = 5,] }"); }
public void MSOXWSCORE_S04_TC21_VerifyItemWithIsDraftAndIsUnmodified() { #region Step 1: Create the item which will be saved. // Define the MessageType item to create. EmailAddressType addressTo = new EmailAddressType(); addressTo.EmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); EmailAddressType addressCc = new EmailAddressType(); addressCc.EmailAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); MessageType[] message = new MessageType[1] { new MessageType { ToRecipients = new EmailAddressType[] { addressTo, addressCc }, CcRecipients = new EmailAddressType[] { addressCc, addressTo }, Subject = Common.GenerateResourceName(this.Site, "ItemSaveOnly") } }; // Call the CreateItem operation. CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.inbox, message); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // One created item should be returned. Site.Assert.AreEqual<int>( 1, createdItemIds.GetLength(0), "One created item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdItemIds.GetLength(0)); #endregion #region Step 2: Get the created item. // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); // If the item is saved, the IsDraft element should be true and the IsUnmodified element should be false. ItemInfoResponseMessageType itemInfoResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; ArrayOfRealItemsType arrayOfRealItemsType = itemInfoResponseMessage.Items; Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1608, Expected result:{0}, Actual result:{1}", true, arrayOfRealItemsType.Items[0].IsDraft); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1608 bool isVerifiedR1608 = arrayOfRealItemsType.Items[0].IsDraftSpecified && arrayOfRealItemsType.Items[0].IsDraft; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1608, 1608, @"[In t:ItemType Complex Type] [IsDraft is] True, indicates an item has not been sent."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1615, Expected result:{0}, Actual result:{1}", false, arrayOfRealItemsType.Items[0].IsUnmodified); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1615 bool isVerifiedR1615 = arrayOfRealItemsType.Items[0].IsUnmodifiedSpecified && !arrayOfRealItemsType.Items[0].IsUnmodified; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1615, 1615, @"[In t:ItemType Complex Type] otherwise [IsUnmodified is] false, indicates [an item has been modified]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R96"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R96 // The schema is validated, the DisplayCc element is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( arrayOfRealItemsType.Items[0].DisplayCc, 96, @"[In t:ItemType Complex Type] [The element ""DisplayCc""] Specifies the display string that is used for the contents of the Cc box."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R97"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R97 // The schema is validated, the DisplayCc element is concatenated by the display names of all Cc recipients, so this requirement can be captured. this.Site.CaptureRequirementIfAreEqual<string>( (Common.GetConfigurationPropertyValue("User2Name", this.Site) + "; " + Common.GetConfigurationPropertyValue("User1Name", this.Site)).ToUpper(new CultureInfo(TestSuiteHelper.Culture, false)), arrayOfRealItemsType.Items[0].DisplayCc.ToUpper(new CultureInfo(TestSuiteHelper.Culture, false)), 97, @"[In t:ItemType Complex Type] This [DisplayCc] is the concatenated string of all Cc recipient display names."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R98"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R98 // The schema is validated, the DisplayTo element is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( arrayOfRealItemsType.Items[0].DisplayTo, 98, @"[In t:ItemType Complex Type] [The element ""DisplayTo""] Specifies the display string that is used for the contents of the To box."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R99"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R99 // The schema is validated, the DisplayTo element is concatenated by the display names of all To recipients, so this requirement can be captured. this.Site.CaptureRequirementIfAreEqual<string>( (Common.GetConfigurationPropertyValue("User1Name", this.Site) + "; " + Common.GetConfigurationPropertyValue("User2Name", this.Site)).ToUpper(new CultureInfo(TestSuiteHelper.Culture, false)), arrayOfRealItemsType.Items[0].DisplayTo.ToUpper(new CultureInfo(TestSuiteHelper.Culture, false)), 99, @"[In t:ItemType Complex Type] This [DisplayTo] is the concatenated string of all To recipient display names."); #endregion #region Step 3: Create the item which will be sent. // Define the CreateItem request. CreateItemType requestItem = new CreateItemType(); requestItem.MessageDispositionSpecified = true; requestItem.MessageDisposition = MessageDispositionType.SendOnly; requestItem.Items = new NonEmptyArrayOfAllItemsType(); message = new MessageType[1] { new MessageType { ToRecipients = new EmailAddressType[] { addressTo }, Subject = Common.GenerateResourceName(this.Site, "ItemSendOnly") } }; requestItem.Items.Items = message; // Call the CreateItem operation. createItemResponse = this.COREAdapter.CreateItem(requestItem); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Step 4: Get the received item. // Find the received item in the Inbox folder. ItemIdType[] findItem = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, message[0].Subject, "User1"); // The result of FindItemsInFolder should not be null. Site.Assert.IsNotNull( findItem, "The result of FindItemsInFolder should not be null."); // One item should be returned. Site.Assert.AreEqual<int>( 1, findItem.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, findItem.GetLength(0)); // Get the found item. getItemResponse = this.CallGetItemOperation(findItem); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); // If the item is sent, the IsDraft element should be false and the IsUnmodified element should be true. itemInfoResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; arrayOfRealItemsType = itemInfoResponseMessage.Items; Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1609, Expected result:{0}, Actual result:{1}", false, arrayOfRealItemsType.Items[0].IsDraft); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1609 bool isVerifiedR1609 = arrayOfRealItemsType.Items[0].IsDraftSpecified && !arrayOfRealItemsType.Items[0].IsDraft; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1609, 1609, @"[In t:ItemType Complex Type] otherwise [IsDraft is] false, indicates [an item has been sent]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1614, Expected result:{0}, Actual result:{1}", true, arrayOfRealItemsType.Items[0].IsUnmodified); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1614 bool isVerifiedR1614 = arrayOfRealItemsType.Items[0].IsUnmodifiedSpecified && arrayOfRealItemsType.Items[0].IsUnmodified; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1614, 1614, @"[In t:ItemType Complex Type] [IsUnmodified is] True, indicates an item has not been modified."); #endregion }
public void MSOXWSCORE_S05_TC21_ResponseObjectsProposeNewTime() { Site.Assume.IsTrue(Common.IsRequirementEnabled(2302, this.Site), "Exchange 2007, Exchange 2010, and the initial release of Exchange 2013 do not support the ProposeNewTime element. "); #region Organizer sends meeting to attendee. CalendarItemType item = new CalendarItemType(); item.RequiredAttendees = new AttendeeType[1]; EmailAddressType attendeeEmail = new EmailAddressType(); attendeeEmail.EmailAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); AttendeeType attendee = new AttendeeType(); attendee.Mailbox = attendeeEmail; item.RequiredAttendees[0] = attendee; CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { item }; createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem); createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendOnlyToAll; createItemRequest.SendMeetingInvitationsSpecified = true; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // One created item should be returned. Site.Assert.AreEqual<int>( 1, createdItemIds.GetLength(0), "One created item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdItemIds.GetLength(0)); #endregion #region Attendee gets the meeting request ItemIdType[] findItemIds = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, createItemRequest.Items.Items[0].Subject, "User2"); Site.Assert.AreEqual<int>(1, findItemIds.Length, "Attendee should receive the meeting request"); GetItemResponseType getItemResponse = this.CallGetItemOperation(findItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); // Check whether the child elements of ResponseObjects have been returned successfully. ItemInfoResponseMessageType getItems = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; ResponseObjectType[] responseObjects = getItems.Items.Items[0].ResponseObjects; foreach (ResponseObjectType responseObject in responseObjects) { if (responseObject.GetType() == typeof(ProposeNewTimeType)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2302"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2302 // Element ProposeNewTime is returned from server, this requirement can be captured directly. this.Site.CaptureRequirement( 2302, @"[In Appendix C: Product Behavior] Implementation does support the ProposeNewTime element which specifies the response object that is used to propose a new time. (<82> Section 2.2.4.33: This element [ProposeNewTime] was introduced in Exchange 2013 SP1.)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2135"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2135 // Element ProposeNewTime is returned from server and pass schema validation, this requirement can be captured directly. this.Site.CaptureRequirement( 2135, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] The type of ProposeNewTime is t:ProposeNewTimeType ([MS-OXWSCDATA] section 2.2.4.38)."); break; } } this.CleanItemsSentOut(new string[] { createItemRequest.Items.Items[0].Subject }); this.ExistItemIds.Remove(getItems.Items.Items[0].ItemId); #endregion }
public void MSOXWSCORE_S05_TC20_CreateMeetingItemWithInvalidItemClass() { #region Step 1: Create the Meeting item with ItemClass set to IPM.DistList. CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); CalendarItemType item = new CalendarItemType(); createItemRequest.Items.Items = new ItemType[] { item }; createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 1); createItemRequest.Items.Items[0].ItemClass = "IPM.DistList"; DistinguishedFolderIdType folderIdForCreateItems = new DistinguishedFolderIdType(); folderIdForCreateItems.Id = DistinguishedFolderIdNameType.calendar; createItemRequest.SavedItemFolderId = new TargetFolderIdType(); createItemRequest.SavedItemFolderId.Item = folderIdForCreateItems; createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy; createItemRequest.SendMeetingInvitationsSpecified = true; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Meeting item with ItemClass IPM.DistList."); #endregion #region Step 2: Create the Meeting item with ItemClass set to IPM.Post. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 2); createItemRequest.Items.Items[0].ItemClass = "IPM.Post"; createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Meeting item with ItemClass IPM.Post."); #endregion #region Step 3: Create the Meeting item with ItemClass set to IPM.Task. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 3); createItemRequest.Items.Items[0].ItemClass = "IPM.Task"; createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Meeting item with ItemClass IPM.Task."); #endregion #region Step 4: Create the Meeting item with ItemClass set to IPM.Contact. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 4); createItemRequest.Items.Items[0].ItemClass = "IPM.Contact"; createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Meeting item with ItemClass IPM.Contact."); #endregion #region Step 5: Create the Meeting item with ItemClass set to random string. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 5); createItemRequest.Items.Items[0].ItemClass = Common.GenerateResourceName(this.Site, "ItemClass"); createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Meeting item with ItemClass is set to a random string."); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2023"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2023 this.Site.CaptureRequirement( 2023, @"[In t:ItemType Complex Type] If invalid values are set for these items in the CreateItem request, an ErrorObjectTypeChanged ([MS-OXWSCDATA] section 2.2.5.24) response code will be returned in the CreateItem response."); }
public void MSOXWSCORE_S07_TC18_CreateTaskItemWithInvalidItemClass() { #region Step 1: Create the Task item with ItemClass set to IPM.Appointment. CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); TaskType item = new TaskType(); createItemRequest.Items.Items = new ItemType[] { item }; createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 1); createItemRequest.Items.Items[0].ItemClass = "IPM.Appointment"; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Task item with ItemClass IPM.Appointment."); #endregion #region Step 2: Create the Task item with ItemClass set to IPM.Contact. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 2); createItemRequest.Items.Items[0].ItemClass = "IPM.Contact"; createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Task item with ItemClass IPM.Contact."); #endregion #region Step 3: Create the Task item with ItemClass set to IPM.Post. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 3); createItemRequest.Items.Items[0].ItemClass = "IPM.Post"; createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Task item with ItemClass IPM.Task."); #endregion #region Step 4: Create the Task item with ItemClass set to IPM.DistList. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 4); createItemRequest.Items.Items[0].ItemClass = "IPM.DistList"; createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Task item with ItemClass IPM.DistList."); #endregion #region Step 5: Create the Task item with ItemClass set to random string. createItemRequest.Items.Items[0].Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 5); createItemRequest.Items.Items[0].ItemClass = Common.GenerateResourceName(this.Site, "ItemClass"); createItemResponse = this.COREAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>( ResponseCodeType.ErrorObjectTypeChanged, createItemResponse.ResponseMessages.Items[0].ResponseCode, "ErrorObjectTypeChanged should be returned if create a Task item with ItemClass is set to a random string."); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2023"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2023 this.Site.CaptureRequirement( 2023, @"[In t:ItemType Complex Type] If invalid values are set for these items in the CreateItem request, an ErrorObjectTypeChanged ([MS-OXWSCDATA] section 2.2.5.24) response code will be returned in the CreateItem response."); }
public void MSOXWSCORE_S04_TC17_VerifyEmailWithResponseObjects() { #region Step 1: Create a message with IsReadReceiptRequested. // Define the MessageType item which will be created. MessageType[] messages = new MessageType[] { new MessageType() }; messages[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); EmailAddressType email = new EmailAddressType(); email.EmailAddress = Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); messages[0].ToRecipients = new EmailAddressType[1]; messages[0].ToRecipients[0] = email; messages[0].IsReadReceiptRequestedSpecified = true; messages[0].IsReadReceiptRequested = true; // Define the request of CreateItem operation. CreateItemType requestItem = new CreateItemType(); requestItem.MessageDispositionSpecified = true; requestItem.MessageDisposition = MessageDispositionType.SendOnly; requestItem.Items = new NonEmptyArrayOfAllItemsType(); requestItem.Items.Items = messages; // Call the CreateItem operation. CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(requestItem); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Step 2: Get the message with response objects in inbox. // Find the received item in the Inbox folder. ItemIdType[] foundItems = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, messages[0].Subject, "User1"); // The result of FindItemsInFolder should not be null. Site.Assert.IsNotNull( foundItems, "The result of FindItemsInFolder should not be null."); // One item should be returned. Site.Assert.AreEqual<int>( 1, foundItems.GetLength(0), "One item should be returned! Expected count: {0}, actual count: {1}", 1, foundItems.GetLength(0)); // Get information from the found item. GetItemResponseType getItemResponse = this.CallGetItemOperation(foundItems); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); // Check whether the child elements of ResponseObjects have been returned successfully. ItemInfoResponseMessageType getItems = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; ResponseObjectType[] responseObjects = getItems.Items.Items[0].ResponseObjects; Site.Assert.IsNotNull(responseObjects, "The ResponseObjects should not be null."); // Receivers could reply, reply all, forward or send read receipt for the received item, so there should be four child elements in ResponseObjects. Site.Assert.AreEqual<int>( 4, responseObjects.Length, "Four child elements in ResponseObjects should be returned! Expected count: {0}, actual count: {1}", 4, responseObjects.Length); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // The type of the child element should be ReplyToItemType, ForwardItemType, ReplyAllToItemType or SuppressReadReceiptType. foreach (ResponseObjectType responseObject in responseObjects) { if (responseObject.GetType() == typeof(ReplyToItemType)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1371"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1371 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1371, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] The type of ReplyToItem is t:ReplyToItemType ([MS-OXWSCDATA] section 2.2.4.56)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R131"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R131 // The response object with ReplyToItemType type is not null and the schema is validated, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( responseObject, 131, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] [The element ""ReplyToItem""] Specifies a reply to the sender of an item."); } else if (responseObject.GetType() == typeof(ForwardItemType)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1372"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1372 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1372, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] The type of ForwardItem is t:ForwardItemType ([MS-OXWSCDATA] section 2.2.4.33)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R132"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R132 // The response object with ForwardItemType type is not null and the schema is validated, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( responseObject, 132, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] [The element ""ForwardItem""] Specifies a server store item to be forwarded to recipients."); } else if (responseObject.GetType() == typeof(ReplyAllToItemType)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1373"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1373 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1373, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] The type of ReplyAllToItem is t:ReplyAllToItemType ([MS-OXWSCDATA] section 2.2.4.54)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R133"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R133 // The response object with ReplyAllToItemType type is not null and the schema is validated, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( responseObject, 133, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] [The element ""ReplyAllToItem""] Specifies a reply to the sender and all identified recipients of an item in the server store."); } else if (responseObject.GetType() == typeof(SuppressReadReceiptType)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1376"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1376 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1376, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] The type of SuppressReadReceipt is t:SuppressReadReceiptType ([MS-OXWSCDATA] section 2.2.4.61)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R136"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R136 // The response object with SuppressReadReceiptType type is not null and the schema is validated, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( responseObject, 136, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] [The element ""SuppressReadReceipt""] Specifies that read receipts are to be suppressed."); } else { Site.Assume.Fail( string.Format( "The type of responseObject should be one of the following types: ReplyToItemType, ForwardItemType, ReplyAllToItemType or SuppressReadReceiptType, actual {0}", responseObject.GetType())); } } #endregion #region Step 3: Delete messages in inbox. // Delete the created item. this.COREAdapter.DeleteItem(new DeleteItemType() { DeleteType = DisposalType.HardDelete, ItemIds = foundItems }); this.ExistItemIds.Clear(); this.FindNewItemsInFolder(DistinguishedFolderIdNameType.inbox); #endregion }
/// <summary> /// Create item within a specific folder. /// </summary> /// <param name="toAddress">To address of created item</param> /// <param name="folderId">Parent folder id of the created item.</param> /// <param name="subject">Subject of the item.</param> /// <returns>Id of created item.</returns> protected ItemIdType CreateItem(string toAddress, string folderId, string subject) { CreateItemType createItemRequest = new CreateItemType(); createItemRequest.MessageDispositionSpecified = true; createItemRequest.MessageDisposition = MessageDispositionType.SaveOnly; createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy; createItemRequest.SendMeetingInvitationsSpecified = true; createItemRequest.SavedItemFolderId = new TargetFolderIdType(); DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); DistinguishedFolderIdNameType distinguishedFolderIdName = new DistinguishedFolderIdNameType(); bool isSuccess = Enum.TryParse<DistinguishedFolderIdNameType>(folderId, true, out distinguishedFolderIdName); if (isSuccess) { distinguishedFolderId.Id = distinguishedFolderIdName; createItemRequest.SavedItemFolderId.Item = distinguishedFolderId; } else { FolderIdType id = new FolderIdType(); id.Id = folderId; createItemRequest.SavedItemFolderId.Item = id; } MessageType message = new MessageType(); message.Subject = subject; EmailAddressType address = new EmailAddressType(); address.EmailAddress = toAddress; // Set this message to unread. message.IsRead = false; message.IsReadSpecified = true; message.ToRecipients = new EmailAddressType[1]; message.ToRecipients[0] = address; BodyType body = new BodyType(); body.Value = Common.GenerateResourceName(this.Site, "Test Mail Body"); message.Body = body; createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[1]; createItemRequest.Items.Items[0] = message; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); ItemInfoResponseMessageType itemInfo = (ItemInfoResponseMessageType)createItemResponse.ResponseMessages.Items[0]; // Return item id. if (itemInfo.Items.Items != null) { return itemInfo.Items.Items[0].ItemId; } else { return null; } }
/// <summary> /// Creates items on the server. /// </summary> /// <param name="createItemRequest">Request message of "CreateItem" operation.</param> /// <returns>Response message of "CreateItem" operation.</returns> public CreateItemResponseType CreateItem(CreateItemType createItemRequest) { CreateItemResponseType createItemResponse = this.exchangeServiceBinding.CreateItem(createItemRequest); return createItemResponse; }
public void MSOXWSMSG_S01_TC07_GetMessageWithFilterHtmlContent() { Site.Assume.IsTrue(Common.GetConfigurationPropertyValue("SutVersion", this.Site).Equals("ExchangeServer2007") == false, "Exchange 2007 does not use the FilterHtmlContent element."); #region Create a message with html body #region Define a CreateItem request string unsafeHtmlContent = "<html><body><b>Bold</b><script>alert('Alert!');</script></body></html>"; CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the subject of message. Subject = this.Subject, Body = new BodyType() { BodyType1 = BodyTypeType.HTML, Value = unsafeHtmlContent, } } } }, }; #endregion CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); #endregion #region Get the created message via itemIdType in above steps #region Send the GetItem requst which the FilterHtmlContent is set true. GetItemType getItemRequest = new GetItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, FilterHtmlContent = true, FilterHtmlContentSpecified = true, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); MessageType message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21193"); this.Site.CaptureRequirementIfIsFalse( message.Body.Value.Contains("<script>alert('Alert!');</script>"), "MS-OXWSCDATA", 21193, @"[In t:ItemResponseShapeType Complex Type] [FilterHtmlContent is] True, specifies HTML content filtering is enabled."); #endregion #region Send the GetItem requst which the FilterHtmlContent is set false. getItemRequest.ItemShape.FilterHtmlContent = false; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21194"); this.Site.CaptureRequirementIfIsTrue( message.Body.Value.Contains("<script>alert('Alert!');</script>"), "MS-OXWSCDATA", 21194, @"[In t:ItemResponseShapeType Complex Type] otherwise [FilterHtmlContent is] false, specifies [HTML content filtering is not enabled]."); #endregion #endregion #region Delete the message created DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion }
/// <summary> /// Create a message in inbox . /// </summary> /// <returns>Id of the created message.</returns> protected ItemIdType CreateMessage() { CreateItemType createItemRequest = new CreateItemType() { MessageDisposition = MessageDispositionType.SaveOnly, MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType() { Item = new DistinguishedFolderIdType() { Id = DistinguishedFolderIdNameType.inbox } }, Items = new NonEmptyArrayOfAllItemsType() { Items = new ItemType[] { new MessageType() { Subject = Common.GenerateResourceName(this.Site, "Attachment parent message ") } } } }; CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); ItemInfoResponseMessageType itemInfo = createItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; MessageType message = (MessageType)itemInfo.Items.Items[0]; return message.ItemId; }
public void MSOXWSMSG_S01_TC01_CreateGetDeleteMessageWithAllElementsExceptAboutDelegate() { #region Create a message with all elements except ReceivedBy and ReceivedRepresenting elements #region Define a CreateItem request CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the recipient that receives a carbon copy of the message. CcRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, // Specify the recipient that receives a blind carbon copy of the message. BccRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.MeetingRoom } }, // Specify the subject of message. Subject = this.Subject, // The sender of message requests a read receipt. IsReadReceiptRequested = true, IsReadReceiptRequestedSpecified = true, // The sender of message requests a delivery receipt. IsDeliveryReceiptRequested = true, IsDeliveryReceiptRequestedSpecified = true, // Response to the message is requested. IsResponseRequested = true, IsResponseRequestedSpecified = true, // Specify the address to which replies should be sent. ReplyTo = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, // Specify the Usenet header that is used to correlate replies with their original message. References = this.MsgReference, IsRead = true, IsReadSpecified = true, } } }, }; #endregion CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); #endregion #region Verify the requirements about CreateItem operation // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R111"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R111 Site.CaptureRequirementIfIsNotNull( createItemResponse, 111, @"[In CreateItem] The protocol client sends a CreateItemSoapIn request WSDL message, and the protocol server responds with a CreateItemSoapOut response WSDL message."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R112"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R112 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 112, @"[In CreateItem]If the CreateItem WSDL operation request is successful, the server returns a CreateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.2.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R113"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R113 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, this.infoItems[0].ResponseCode, 113, @"[In CreateItem] [A successful CreateItem operation request returns a CreateItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element is set to ""NoError"". "); #endregion #region Get the created message via itemIdType in above steps #region The getItemResponseOfFirstMessage is used to store the getItemResponseOfFirstMessage gotten from server when the BaseShape element is set to IdOnly. GetItemType getItemRequest = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.IdOnly); GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R127"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R127 bool isVerifyR127 = Common.IsIdOnly((XmlElement)this.MSGAdapter.LastRawResponseXml, "t:Message", "t:ItemId"); Site.CaptureRequirementIfIsTrue( isVerifyR127, 127, @"[In GetItem] [The BaseShape child element in ItemShape element] Set this element[BaseShape element] to IdOnly to return only the item ID."); #endregion #region The getItemResponseOfFirstMessage is used to store the getItemResponseOfFirstMessage got from server when the BaseShape element is set to AllProperties. getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(getItemResponse); Site.Assert.IsNotNull(this.infoItems, @"The GetItem response should contain one or more items of ItemInfoResponseMessageType."); MessageType messageItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0) as MessageType; Site.Assert.IsNotNull(messageItem, @"The message item returned from server response should not be null."); #region Verify requirements about GetItem operation // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R133"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R133 Site.CaptureRequirementIfIsNotNull( getItemResponse, 133, @"[In GetItem] The protocol client sends a GetItemSoapIn request WSDL message, and the protocol server responds with a GetItemSoapOut response WSDL message."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R134"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R134 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 134, @"[In GetItem] If the GetItem WSDL operation request is successful, the server returns a GetItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.4.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the GetItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R135"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R135 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, this.infoItems[0].ResponseCode, 135, @"[In GetItem] [A successful GetItem operation request returns a GetItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the GetItemResponseMessage element is set to ""NoError"". "); bool isVerifiedR198 = Common.IsIdOnly((XmlElement)this.MSGAdapter.LastRawResponseXml, "t:Message", "t:ItemId"); this.Site.CaptureRequirementIfIsFalse( isVerifiedR198, 198, @"[In GetItem] [The BaseShape child element in ItemShape element] Set it[BaseShape element] to AllProperties to return all of the properties used by the server to construct a message."); #endregion #region Verify the child elements of the MessageType // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R2916, expected the length of EmailAddress is greater than zero, actual length is {0}", messageItem.ToRecipients[0].EmailAddress.Length); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R2916 // The type of the EmailAddress is verified in adapter capture code, only need to check whether this string has a minimum of one character. this.Site.CaptureRequirementIfIsTrue( messageItem.ToRecipients[0].EmailAddress.Length > 0, 2916, @"[In t:MessageType Complex Type] When the Mailbox element of ToRecipients element include an EmailAddress element of t:NonEmptyStringType, the t:NonEmptyStringType simple type specifies a string that MUST have a minimum of one character."); if (Common.IsRequirementEnabled(1428001, this.Site)) { this.Site.CaptureRequirementIfAreEqual<MailboxTypeType>( MailboxTypeType.Mailbox, messageItem.ToRecipients[0].MailboxType, 2912, @"[In t:MessageType Complex Type]When the Mailbox element of ToRecipients element include an MailboxType element of t:MailboxTypeType, the value ""Mailbox"" of t:MailboxTypeType specifies a mail-enabled directory service object."); } Site.Assert.AreEqual<string>(this.Recipient1.ToLower(), messageItem.ToRecipients[0].EmailAddress.ToLower(), "The EmailAddress of the ToRecipients element in GetItem response should be equal with the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R30"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 30, @"[In t:MessageType Complex Type] ToRecipients element Specifies a collection of recipients of an email."); Site.Assert.AreEqual<string>(this.Recipient2.ToLower(), messageItem.CcRecipients[0].EmailAddress.ToLower(), "The EmailAddress of the CcRecipients element in GetItem response should be equal with the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R33"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 33, @"[In t:MessageType Complex Type] CcRecipients element Specifies a collection of recipients that receive a carbon copy (Cc) of an email."); Site.Assert.AreEqual<string>(this.MeetingRoom.ToLower(), messageItem.BccRecipients[0].EmailAddress.ToLower(), "The EmailAddress of the BccRecipients element in GetItem response should be equal with the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R36"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 36, @"[In t:MessageType Complex Type] BccRecipients element Specifies a collection of recipients that receive a blind carbon copy (Bcc) of an email."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R42"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R42 this.Site.CaptureRequirementIfIsTrue( messageItem.IsReadReceiptRequested, 42, @"[In t:MessageType Complex Type] [IsReadReceiptRequested element] A text value of ""true"" indicates that a read receipt is requested from the recipient of the message."); // If the R42 is verified, then the IsReadReceiptRequested is a boolean and it indicates that a read receipt is requested from the recipient of the message. // So the R39 will be verified. this.Site.CaptureRequirement( 39, @"[In t:MessageType Complex Type] IsReadReceiptRequested element Specifies a Boolean value that indicates whether the sender of a message requests a read receipt."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R46"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R46 this.Site.CaptureRequirementIfIsTrue( messageItem.IsDeliveryReceiptRequested, 46, @"[In t:MessageType Complex Type] [IsDeliveryReceiptRequested element] A text value of ""true"" indicates that a delivery receipt has been requested from the recipient of the message."); // If the R46 is verified, then the IsDeliveryReceiptRequested is a boolean and it indicates that a delivery receipt has been requested from the recipient of the message. // So the R43 will be verified. this.Site.CaptureRequirement( 43, @"[In t:MessageType Complex Type] IsDeliveryReceiptRequested element Specifies a Boolean value that indicates whether the sender of the message has requested a delivery receipt."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R61"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R61 this.Site.CaptureRequirementIfIsTrue( messageItem.IsRead, 61, @"[In t:MessageType Complex Type] [IsRead element]The text value of ""true"" indicates that the message has been read."); // If R61 is verified, then the IsRead is boolean and it indicates that the message has been read. // So the R59 will be verified. this.Site.CaptureRequirement( 59, @"[In t:MessageType Complex Type] IsRead element Specifies a Boolean value that indicates whether the message has been read."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R65"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R65 this.Site.CaptureRequirementIfIsTrue( messageItem.IsResponseRequested, 65, @"[In t:MessageType Complex Type] [IsResponseRequested element] A text value of ""true"" indicates that a response has been requested."); // If R65 is verified, then the IsResponseRequested is boolean and it indicates that a response has been requested. // So R62 will be verified. this.Site.CaptureRequirement( 62, @"[In t:MessageType Complex Type] IsResponseRequested element Specifies a Boolean value that indicates whether a response to an email has been requested."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R66"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R66 this.Site.CaptureRequirementIfAreEqual<string>( this.MsgReference, messageItem.References, 66, @"[In t:MessageType Complex Type] References element Specifies the Usenet header that is used to correlate replies with their original message."); Site.Assert.AreEqual<string>(this.Recipient2.ToLower(), messageItem.ReplyTo[0].EmailAddress.ToLower(), "The EmailAddress of the From element in GetItem response should be equal to the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R69"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 69, @"[In t:MessageType Complex Type] ReplyTo element Specifies a collection of addresses to send replies to. "); #endregion #region Verify the requirements about the read/write element of MessageType // The messageRequest is used to save the message in request to create. MessageType messageRequest = createItemRequest.Items.Items[0] as MessageType; Site.Assert.IsNotNull(messageRequest, @"The CreateItem request should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R32"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R32 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the ToRecipients value from getItem response is equal to the setting ToRecipients element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.ToRecipients[0].EmailAddress.ToLower(), messageItem.ToRecipients[0].EmailAddress.ToLower(), 32, @"[In t:MessageType Complex Type] [ToRecipients element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R35"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R35 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the CcRecipients value from getItem response is equal to the setting CcRecipients element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.CcRecipients[0].EmailAddress.ToLower(), messageItem.CcRecipients[0].EmailAddress.ToLower(), 35, @"[In t:MessageType Complex Type] [CcRecipients element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R38"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R38 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the BccRecipients value from getItem response is equal to the setting BccRecipients element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.BccRecipients[0].EmailAddress.ToLower(), messageItem.BccRecipients[0].EmailAddress.ToLower(), 38, @"[In t:MessageType Complex Type] [BccRecipients element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R41"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R41 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the IsReadReceiptRequested value from getItem response is equal to the setting IsReadReceiptRequested element value in createItem request. Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsReadReceiptRequested, messageItem.IsReadReceiptRequested, 41, @"[In t:MessageType Complex Type] [IsReadReceiptRequested element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R45"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R45 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the IsDeliveryReceiptRequested value from getItem response is equal to the setting IsDeliveryReceiptRequested element value in createItem request. Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsDeliveryReceiptRequested, messageItem.IsDeliveryReceiptRequested, 45, @"[In t:MessageType Complex Type] [IsDeliveryReceiptRequested element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R64"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R64 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the IsResponseRequested value from getItem response is equal to the setting IsResponseRequested element value in createItem request. Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsResponseRequested, messageItem.IsResponseRequested, 64, @"[In t:MessageType Complex Type] [IsResponseRequested element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R68"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R68 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the References value from getItem response is equal to the setting References element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.References, messageItem.References, 68, @"[In t:MessageType Complex Type] [References element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R71"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R71 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the ReplyTo value from getItem response is equal to the setting ReplyTo element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.ReplyTo[0].EmailAddress.ToLower(), messageItem.ReplyTo[0].EmailAddress.ToLower(), 71, @"[In t:MessageType Complex Type] [ReplyTo element] This is a read/write element."); this.Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsRead, messageItem.IsRead, 60, @"[In t:MessageType Complex Type] [IsRead element] This is a read/write element."); #endregion #endregion #endregion #region Delete the message created DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); GetItemType getdeletedItemRequest = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.IdOnly); GetItemResponseType getdeletedItemResponse = this.MSGAdapter.GetItem(getdeletedItemRequest); // verify whether the creating message deleted if (getdeletedItemResponse != null && getdeletedItemResponse.ResponseMessages != null && getdeletedItemResponse.ResponseMessages.Items != null) { if (getdeletedItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success) { Site.Assert.Fail("Server should not return success for get the email messages information, because the created message have been deleted."); } } #region Verify requirements about DeleteItem operation // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R152"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R152 Site.CaptureRequirementIfIsNotNull( deleteItemResponse, 152, @"[In DeleteItem] The protocol client sends a DeleteItemSoapIn request WSDL message, and the protocol server responds with a DeleteItemSoapOut response WSDL message."); Site.Assert.IsNotNull(deleteItemResponse.ResponseMessages.Items[0], @"The first item of the array of InfoItems in server response should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R153"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R153 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, deleteItemResponse.ResponseMessages.Items[0].ResponseClass, 153, @"[In DeleteItem] If the DeleteItem WSDL operation request is successful, the server returns a DeleteItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.3.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the DeleteItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); Site.Assert.IsNotNull(deleteItemResponse.ResponseMessages.Items[0].ResponseCode, @"The ResponseCode property of the first item of the array of InfoItems should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R154"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R154 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, deleteItemResponse.ResponseMessages.Items[0].ResponseCode, 154, @"[In DeleteItem] [A successful DeleteItem operation request returns a DeleteItemResponse element] The ResponseCode element, as specified by [MS-OXWSCDATA] section 2.2.4.67, of the DeleteItemResponseMessage element is set to ""NoError"". "); #endregion #endregion }
/// <summary> /// Create items in the Exchange store /// </summary> /// <param name="createItemRequest">Specify a request to create items on the server.</param> /// <returns>A response to CreateItem operation request.</returns> public CreateItemResponseType CreateItem(CreateItemType createItemRequest) { CreateItemResponseType response = this.exchangeServiceBinding.CreateItem(createItemRequest); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported. this.VerifySoapVersion(); // Verify transport type related requirement. this.VerifyTransportType(); this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyCreateItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyItemId(response); return response; }
public void MSOXWSMSG_S06_TC01_OperateMultipleMessages() { #region Create multiple message string subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 0); string anotherSubject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 1); CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, Items = new NonEmptyArrayOfAllItemsType { // Create an responseMessageItem with two MessageType instances. Items = new MessageType[] { new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, Subject = subject, }, new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, Subject = anotherSubject, } } }, }; CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(createItemResponse), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the first ItemId of message responseMessageItem got from the createItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType itemIdType1 = new ItemIdType(); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the second ItemId. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType itemIdType2 = new ItemIdType(); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Get the multiple messages which created GetItemType getItemRequest = new GetItemType { // Set the two ItemIds got from CreateItem response. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(getItemResponse), @"Server should return success for creating the email messages."); #endregion #region Update the multiple messages which created UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, // Create two ItemChangeType instances. ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType1, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the first message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } } } }, } }, new ItemChangeType { Item = itemIdType2, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the second message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } } } }, } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(updateItemResponse), @"Server should return success for updating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(updateItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the UpdateItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the UpdateItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Copy the updated multiple message to junkemail CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType1, itemIdType2, }, // Copy the message to junk email folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.junkemail } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(copyItemResponse), @"Server should return success for copying the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the CopyItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType copyItemIdType1 = new ItemIdType(); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the CopyItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType copyItemIdType2 = new ItemIdType(); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Move the copied multiple message from junkemail to deleteditems MoveItemType moveItemRequest = new MoveItemType { // Set to copied message responseMessageItem id. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 }, // Move the copied messages to deleted items folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.deleteditems } } }; MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(moveItemResponse), @"Server should return success for moving the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(moveItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the MoveItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the MoveItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Send multiple messages SendItemType sendItemRequest = new SendItemType { // Set to the two updated messages' ItemIds. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, // Do not save copy. SaveItemToFolder = false, }; SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(sendItemResponse), @"Server should return success for sending the email messages."); #endregion #region Delete the copied messages DeleteItemType deleteItemRequest = new DeleteItemType { // Set to the two copied messages' ItemIds. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion #region Clean up Recipient1's and Recipient2's inbox folders bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient2", this.Site), Common.GetConfigurationPropertyValue("Recipient2Password", this.Site), this.Domain, subject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient2's inbox folder should be cleaned up."); isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient1", this.Site), Common.GetConfigurationPropertyValue("Recipient1Password", this.Site), this.Domain, anotherSubject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up."); #endregion }
/// <summary> /// Create an item in the specified folder. /// </summary> /// <param name="parentFolderType">Type of the parent folder.</param> /// <param name="parentFolderId">ID of the parent folder.</param> /// <param name="itemSubject">Subject of the item which should be created.</param> /// <returns>ID of the created item.</returns> protected ItemIdType CreateItem(DistinguishedFolderIdNameType parentFolderType, string parentFolderId, string itemSubject) { // Create a request for the CreateItem operation and initialize the ItemType instance. CreateItemType createItemRequest = new CreateItemType(); ItemType item = null; // Get different values for item based on different parent folder type. switch (parentFolderType) { case DistinguishedFolderIdNameType.contacts: ContactItemType contact = new ContactItemType(); contact.Subject = itemSubject; contact.FileAs = itemSubject; item = contact; break; case DistinguishedFolderIdNameType.calendar: // Set the sendMeetingInvitations property. CalendarItemCreateOrDeleteOperationType sendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone; createItemRequest.SendMeetingInvitations = (CalendarItemCreateOrDeleteOperationType)sendMeetingInvitations; createItemRequest.SendMeetingInvitationsSpecified = true; CalendarItemType calendar = new CalendarItemType(); calendar.Subject = itemSubject; item = calendar; break; case DistinguishedFolderIdNameType.inbox: MessageType message = new MessageType(); message.Subject = itemSubject; item = message; break; case DistinguishedFolderIdNameType.tasks: TaskType taskItem = new TaskType(); taskItem.Subject = itemSubject; item = taskItem; break; default: Site.Assert.Fail("The parent folder type '{0}' is invalid and the valid folder types are: contacts, calendar, inbox and tasks.", parentFolderType.ToString()); break; } // Set the MessageDisposition property. MessageDispositionType messageDisposition = MessageDispositionType.SaveOnly; createItemRequest.MessageDisposition = (MessageDispositionType)messageDisposition; createItemRequest.MessageDispositionSpecified = true; // Specify the folder in which new items are saved. createItemRequest.SavedItemFolderId = new TargetFolderIdType(); FolderIdType folderId = new FolderIdType(); folderId.Id = parentFolderId; createItemRequest.SavedItemFolderId.Item = folderId; // Specify the collection of items to be created. createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { item }; // Initialize the ID of the created item. ItemIdType createdItemId = null; // Invoke the create item operation and get the response. CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest); if (createItemResponse != null && createItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success) { ItemInfoResponseMessageType info = createItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; Site.Assert.IsNotNull(info, "The items in CreateItem response should not be null."); // Get the ID of the created item. createdItemId = info.Items.Items[0].ItemId; } return createdItemId; }
public void MSOXWSCONT_S01_TC09_VerifyErrorCannotCreateContactInNonContactFolder() { #region Step 1:Create the contact item. CreateItemType createItemRequest = new CreateItemType(); #region Config the contact item createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ContactItemType[1]; // Create a contact item without optional elements. createItemRequest.Items.Items[0] = this.BuildContactItemWithRequiredProperties(); // Configure create item to draft folder to trigger the error. DistinguishedFolderIdType errorDistinguishedFolderId = new DistinguishedFolderIdType(); errorDistinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts; createItemRequest.SavedItemFolderId = new TargetFolderIdType(); createItemRequest.SavedItemFolderId.Item = errorDistinguishedFolderId; #endregion CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<int>( 1, createItemResponse.ResponseMessages.Items.GetLength(0), "Expected Item Count: {0}, Actual Item Count: {1}", 1, createItemResponse.ResponseMessages.Items.GetLength(0)); #endregion #region Capture Code // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R262"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R262 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorCannotCreateContactInNonContactFolder, createItemResponse.ResponseMessages.Items[0].ResponseCode, "MS-OXWSCDATA", 262, @"[In m:ResponseCodeType Simple Type]The value ""ErrorCannotCreateContactInNonContactFolder"" specifies that an attempt was made to create a contact in a folder other than the Contacts folder."); #endregion }
/// <summary> /// Call CreateItem operation. /// </summary> /// <param name="contactItem">The contact item to be created.</param> /// <returns>The CreateItem response.</returns> protected CreateItemResponseType CallCreateItemOperation(ContactItemType contactItem) { CreateItemType createItemRequest = new CreateItemType(); #region Config the contact item createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ContactItemType[1]; // Create a contact item without optional elements. createItemRequest.Items.Items[0] = contactItem; // Configure the SavedItemFolderId of CreateItem request to specify that the created item is saved under which folder. createItemRequest.SavedItemFolderId = new TargetFolderIdType() { Item = new DistinguishedFolderIdType() { Id = DistinguishedFolderIdNameType.contacts, } }; #endregion // Call CreateItem operation. CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest); return createItemResponse; }
/// <remarks/> public System.IAsyncResult BeginCreateItem(CreateItemType CreateItem1, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateItem", new object[] { CreateItem1}, callback, asyncState); }
/// <summary> /// Create the calendar related item elements. /// </summary> /// <param name="request">A request to the CreateItem operation.</param> /// <returns>The response message returned by CreateItem operation.</returns> public CreateItemResponseType CreateItem(CreateItemType request) { if (request == null) { throw new ArgumentException("The request of operation 'CreateItem' should not be null."); } CreateItemResponseType createItemResponse = this.exchangeServiceBinding.CreateItem(request); Site.Assert.IsNotNull(createItemResponse, "If the operation is successful, the response should not be null."); this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCreateItemOperation(createItemResponse, this.exchangeServiceBinding.IsSchemaValidated); return createItemResponse; }
/// <remarks/> public void CreateItemAsync(CreateItemType CreateItem1, object userState) { if ((this.CreateItemOperationCompleted == null)) { this.CreateItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateItemOperationCompleted); } this.InvokeAsync("CreateItem", new object[] { CreateItem1}, this.CreateItemOperationCompleted, userState); }
public void MSOXWSMTGS_S06_TC04_CalendarPermissionLevelEditor() { this.MTGSAdapter = new MS_OXWSMTGSAdapter(); this.MTGSAdapter.Initialize(this.Site); this.SRCHAdapter = new MS_OXWSSRCHAdapter(); this.SRCHAdapter.Initialize(this.Site); this.FOLDAdapter = new MS_OXWSFOLDAdapter(); this.FOLDAdapter.Initialize(this.Site); #region Organizer creates a calendar folder in the inbox folder and grant Editor permission to attendee. // Switch to user organizer. this.FOLDAdapter.SwitchUser(this.Organizer, this.OrganizerPassword, this.Domain); CalendarPermissionSetType calendarPermissionSet = new CalendarPermissionSetType(); calendarPermissionSet.CalendarPermissions = new CalendarPermissionType[1]; calendarPermissionSet.CalendarPermissions[0] = new CalendarPermissionType(); calendarPermissionSet.CalendarPermissions[0].CalendarPermissionLevel = CalendarPermissionLevelType.Editor; calendarPermissionSet.CalendarPermissions[0].UserId = new UserIdType(); calendarPermissionSet.CalendarPermissions[0].UserId.PrimarySmtpAddress = Common.GetConfigurationPropertyValue("AttendeeName", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site); CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "CustomFolderByOrganizer" }, new string[] { "IPF.Appointment" }, null); ((CalendarFolderType)createFolderRequest.Folders[0]).PermissionSet = calendarPermissionSet; // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); // Save the new created folder's folder id. FolderIdType newFolderIdByOrganizer = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; this.FolderToDelete = newFolderIdByOrganizer; #endregion #region Organizer gets the new created folder. // GetFolder request. GetFolderType getNewFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, newFolderIdByOrganizer); // Get the new created folder. GetFolderResponseType getInboxFolderResponse = this.FOLDAdapter.GetFolder(getNewFolderRequest); // Check the response. Common.CheckOperationSuccess(getInboxFolderResponse, 1, this.Site); // Verify the folder is created successfully. FolderInfoResponseMessageType foldersResponseInfo = (FolderInfoResponseMessageType)getInboxFolderResponse.ResponseMessages.Items[0]; Site.Assert.AreEqual<string>(newFolderIdByOrganizer.Id, foldersResponseInfo.Folders[0].FolderId.Id, "The calendar folder should be created successfully in inbox."); #endregion #region Organizer creates a calendar item in the created folder. CalendarItemType calendarItembyOrganizer = new CalendarItemType(); calendarItembyOrganizer.UID = Guid.NewGuid().ToString(); calendarItembyOrganizer.Subject = Common.GenerateResourceName(this.Site, "CalendarItemCreatedByOrganizer"); NonEmptyArrayOfAllItemsType allItemArray = new NonEmptyArrayOfAllItemsType(); allItemArray.Items = new ItemType[] { calendarItembyOrganizer }; CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = allItemArray; createItemRequest.SendMeetingInvitationsSpecified = true; createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone; createItemRequest.SavedItemFolderId = new TargetFolderIdType(); createItemRequest.SavedItemFolderId.Item = newFolderIdByOrganizer; CreateItemResponseType response = this.MTGSAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseClassType>(ResponseClassType.Success, response.ResponseMessages.Items[0].ResponseClass, "The calendar item should be created successfully."); ItemInfoResponseMessageType itemInfoResponse = response.ResponseMessages.Items[0] as ItemInfoResponseMessageType; Site.Assert.IsNotNull(itemInfoResponse, "The calendar item should be created successfully."); ItemIdType itemIdByOrganizer = itemInfoResponse.Items.Items[0].ItemId; #endregion #region Attendee creates a folder in the created folder. // Switch to user attendee. this.FOLDAdapter.SwitchUser(this.Attendee, this.AttendeePassword, this.Domain); createFolderRequest = this.GetCreateFolderRequest(newFolderIdByOrganizer.Id, new string[] { "CustomFolderByAttendee" }, new string[] { "IPF.Appointment" }, null); createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); bool canCreateSubFolder = ResponseClassType.Success == createFolderResponse.ResponseMessages.Items[0].ResponseClass; #endregion #region Attendee creates a calendar item in the created folder. this.SwitchMTGSUser(Role.Attendee); CalendarItemType calendarItembyAttendee = new CalendarItemType(); calendarItembyAttendee.UID = Guid.NewGuid().ToString(); calendarItembyAttendee.Subject = Common.GenerateResourceName(this.Site, "CalendarItemCreatedByAttendee"); createItemRequest.Items.Items[0] = calendarItembyAttendee; response = this.MTGSAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseClassType>(ResponseClassType.Success, response.ResponseMessages.Items[0].ResponseClass, "The calendar item should be created successfully."); itemInfoResponse = response.ResponseMessages.Items[0] as ItemInfoResponseMessageType; bool canCreateOwnItem = null != itemInfoResponse; Site.Assert.IsTrue(canCreateOwnItem, "The calendar item should be created successfully."); ItemIdType itemIdByAttendee = itemInfoResponse.Items.Items[0].ItemId; #endregion #region Attendee gets the calendar item created by hisself. itemInfoResponse = this.GetSingleCalendarItem(Role.Attendee, itemIdByAttendee); bool canReadOwnItem = null != itemInfoResponse; #endregion #region Attendee updates the calendar item created by hisself. CalendarItemType calendarUpdate = new CalendarItemType(); calendarUpdate.Location = this.LocationUpdate; AdapterHelper itemChangeInfo = new AdapterHelper(); itemChangeInfo.FieldURI = UnindexedFieldURIType.calendarLocation; itemChangeInfo.Item = calendarUpdate; itemChangeInfo.ItemId = itemIdByAttendee; // Update the created calendar item. UpdateItemResponseMessageType updatedItem = this.UpdateSingleCalendarItem(Role.Attendee, itemChangeInfo, CalendarItemUpdateOperationType.SendToNone); bool canUpdateOwnItem = null != updatedItem; #endregion #region Attendee deletes the calendar item created by hisself. ResponseMessageType responseMessage = this.DeleteSingleCalendarItem(Role.Attendee, itemIdByAttendee, CalendarItemCreateOrDeleteOperationType.SendToNone); bool canDeleteOwnItem = null != responseMessage && responseMessage.ResponseClass == ResponseClassType.Success; #endregion #region Attendee gets the calendar item created by organizer. itemInfoResponse = this.GetSingleCalendarItem(Role.Attendee, itemIdByOrganizer); bool canReadNotOwnItem = null != itemInfoResponse; #endregion #region Attendee updates the calendar item created by organizer. calendarUpdate = new CalendarItemType(); calendarUpdate.Location = this.LocationUpdate; itemChangeInfo = new AdapterHelper(); itemChangeInfo.FieldURI = UnindexedFieldURIType.calendarLocation; itemChangeInfo.Item = calendarUpdate; itemChangeInfo.ItemId = itemIdByOrganizer; // Update the created calendar item. updatedItem = this.UpdateSingleCalendarItem(Role.Attendee, itemChangeInfo, CalendarItemUpdateOperationType.SendToNone); bool canUpdateNotOwnItem = null != updatedItem; #endregion #region Attendee deletes the calendar item created by organizer. responseMessage = this.DeleteSingleCalendarItem(Role.Attendee, itemIdByOrganizer, CalendarItemCreateOrDeleteOperationType.SendToNone); bool canDeleteNotOwnItem = null != responseMessage && responseMessage.ResponseClass == ResponseClassType.Success; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R91"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R91 bool isVerifiedR91 = canCreateOwnItem && canReadOwnItem && canUpdateOwnItem && canDeleteOwnItem && canReadNotOwnItem && canUpdateNotOwnItem && canDeleteNotOwnItem && !canCreateSubFolder; Site.Assert.IsTrue( isVerifiedR91, "Can create own item is {0};\n" + "Can read own item is {1};\n" + "Can edit own item is {2};\n " + "Can delete own item is {3};\n" + "Can read not own item is {4};\n" + "Can edit not own item is {5};\n" + "Can delete not own item is {6};\n" + "Can create subfolders is {7};\n", canCreateOwnItem, canReadOwnItem, canUpdateOwnItem, canDeleteOwnItem, canReadNotOwnItem, canUpdateNotOwnItem, canDeleteNotOwnItem, canCreateSubFolder); this.Site.CaptureRequirementIfIsTrue( isVerifiedR91, 91, @"[In t:CalendarPermissionLevelType Simple Type] Editor: The user can create, read, edit and delete all items in the folder."); }