Наследование: BaseRequestType
        /// <summary>
        /// Get the calendar related item elements.
        /// </summary>
        /// <param name="request">A request to the GetItem operation.</param>
        /// <returns>The response message returned by GetItem operation.</returns>
        public GetItemResponseType GetItem(GetItemType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The request of operation 'GetItem' should not be null.");
            }

            GetItemResponseType getItemResponse = this.exchangeServiceBinding.GetItem(request);
            Site.Assert.IsNotNull(getItemResponse, "If the operation is successful, the response should not be null.");

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyGetItemOperation(getItemResponse, this.exchangeServiceBinding.IsSchemaValidated);
            return getItemResponse;
        }
        /// <summary>
        /// Get contact item on the server.
        /// </summary>
        /// <param name="getItemRequest">The request of GetItem operation.</param>
        /// <returns>A response to GetItem operation request.</returns>
        public GetItemResponseType GetItem(GetItemType getItemRequest)
        {
            GetItemResponseType getItemResponse = this.exchangeServiceBinding.GetItem(getItemRequest);

            Site.Assert.IsNotNull(getItemResponse, "If the operation is successful, the response should not be null.");

            #region Verify GetItem operation requirements

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyGetContactItem(getItemResponse, this.exchangeServiceBinding.IsSchemaValidated);
            #endregion

            return getItemResponse;
        }
        public void MSOXWSSYNC_S02_TC02_SyncFolderItems_MeetingRequestMessageType()
        {
            #region Step 1. Client invokes SyncFolderItems operation to get the initial syncState of sent items folder.
            DistinguishedFolderIdNameType sentItemsFolder = DistinguishedFolderIdNameType.sentitems;
            SyncFolderItemsType request = this.CreateSyncFolderItemsRequestWithoutOptionalElements(sentItemsFolder, DefaultShapeNamesType.Default);
            SyncFolderItemsResponseType response = this.SYNCAdapter.SyncFolderItems(request);
            SyncFolderItemsResponseMessageType responseMessage = TestSuiteHelper.EnsureResponse<SyncFolderItemsResponseMessageType>(response);
            #endregion

            #region Step 2. Client invokes CreateItem operation to create a MeetingRequestMessageType item.
            // Generate the item subject
            string itemSubject = Common.GenerateResourceName(this.Site, sentItemsFolder + "ItemSubject");
            this.CreateMeetingRequest(this.User2EmailAddress, itemSubject);

            // Make sure that the meeting request exists in inbox folder of User2.
            bool isReceivedInInbox = this.SYNCSUTControlAdapter.IsItemExisting(
                Common.GetConfigurationPropertyValue("User2Name", this.Site),
                Common.GetConfigurationPropertyValue("User2Password", this.Site),
                Common.GetConfigurationPropertyValue("Domain", this.Site),
                DistinguishedFolderIdNameType.inbox.ToString(),
                itemSubject,
                Item.MeetingRequest.ToString());
            Site.Assert.IsTrue(
                isReceivedInInbox,
                string.Format("The meeting request message should exist in inbox folder of '{0}'", Common.GetConfigurationPropertyValue("User2Name", this.Site)));
            #endregion

            #region Step 3. Client invokes SyncFolderItems operation with previous SyncState to sync the operation result in Step 2 and verify related requirements.
            responseMessage = this.GetResponseMessage(sentItemsFolder, responseMessage, DefaultShapeNamesType.Default);

            // Assert the changes in response is not null
            Site.Assert.IsNotNull(responseMessage.Changes, "There is one item created on server, so the changes between server and client should not be null");
            SyncFolderItemsChangesType changes = responseMessage.Changes;

            // Assert both the Items and ItemsElementName are not null
            Site.Assert.IsNotNull(changes.ItemsElementName, "There should be changes information returned in SyncFolderItems response since there is one item created on server.");
            Site.Assert.IsNotNull(changes.Items, "There should be item information returned in SyncFolderItems response since there is one item created on server.");

            Site.Assert.AreEqual<int>(1, changes.Items.Length, "Just one MeetingRequestMessageType item was created in previous step, so the count of Items array in responseMessage.Changes should be 1.");

            // If the type of item in SyncFolderItems response is MeetingRequestMessageType, then requirement MS-OXWSSYNC_R166 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSSYNC_R166");

            // Verify MS-OXWSSYNC requirement: MS-OXWSSYNC_R166
            Site.CaptureRequirementIfIsInstanceOfType(
                (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item,
                typeof(MeetingRequestMessageType),
                166,
                @"[In t:SyncFolderItemsCreateOrUpdateType Complex Type] The type of MeetingRequest is t:MeetingRequestMessageType ([MS-OXWSMTGS] section 2.2.4.22).");

            Site.Assert.AreEqual<int>(1, changes.ItemsElementName.Length, "Just one MeetingRequestMessageType item was created in previous step, so the count of ItemsElementName array in responseMessage.Changes should be 1.");
            bool isMeetingRequestCreated = changes.ItemsElementName[0] == ItemsChoiceType1.Create &&
                    (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.GetType() == typeof(MeetingRequestMessageType);

            // Add the debug information
            Site.Log.Add(
                LogEntryKind.Debug,
                "Verify MS-OXWSSYNC_R1671. Expected value: ItemsElementName: {0}, item type: {1}; actual value: ItemsElementName: {2}, item type: {3}",
                ItemsChoiceType1.Create,
                typeof(MeetingRequestMessageType),
                changes.ItemsElementName[0],
                (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.GetType());

            // If the ItemsElementName of Changes is Create and the type of Item is MeetingRequestMessageType, it indicates a meeting 
            // request has been created on server and synced on client, then requirement MS-OXWSSYNC_R1671 can be captured.
            // Verify MS-OXWSSYNC requirement: MS-OXWSSYNC_R1671
            Site.CaptureRequirementIfIsTrue(
                isMeetingRequestCreated,
                1671,
                @"[In t:SyncFolderItemsCreateOrUpdateType Complex Type] [The element MeetingRequest] specifies a meeting request message to create in the client message store.");
            #endregion

            #region Step 4. Client invokes UpdateItem operation to update the subject of the item that created in Step 2.
            // Generate a new item subject
            string newItemSubject = Common.GenerateResourceName(this.Site, sentItemsFolder + "NewItemSubject");
            ItemIdType[] itemId = new ItemIdType[1] { (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.ItemId };
            this.UpdateItemSubject(itemId, newItemSubject);
            #endregion

            #region Step 5. Client invokes SyncFolderItems operation with previous SyncState to get the operation result in Step 4 and verify related requirements.
            responseMessage = this.GetResponseMessage(sentItemsFolder, responseMessage, DefaultShapeNamesType.AllProperties);

            // Assert the changes in response is not null
            Site.Assert.IsNotNull(responseMessage.Changes, "There is one item updated on server, so the changes between server and client should not be null");
            changes = responseMessage.Changes;

            // Assert both the Items and ItemsElementName are not null
            Site.Assert.IsNotNull(changes.ItemsElementName, "There should be changes information returned in SyncFolderItems response since there is one item updated on server.");
            Site.Assert.IsNotNull(changes.Items, "There should be item information returned in SyncFolderItems response since there is one item updated on server.");

            Site.Assert.AreEqual<int>(1, changes.Items.Length, "Just one MeetingRequestMessageType item was updated in previous step, so the count of Items array in responseMessage.Changes should be 1.");
            Site.Assert.AreEqual<int>(1, changes.ItemsElementName.Length, "Just one MeetingRequestMessageType item was updated in previous step, so the count of ItemsElementName array in responseMessage.Changes should be 1.");
            bool isMeetingRequestUpdated = changes.ItemsElementName[0] == ItemsChoiceType1.Update &&
                (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.GetType() == typeof(MeetingRequestMessageType);

            // Add the debug information
            Site.Log.Add(
                LogEntryKind.Debug,
                "Verify MS-OXWSSYNC_R1672. Expected value: ItemsElementName: {0}, item type: {1}; actual value: ItemsElementName: {2}, item type: {3}",
                ItemsChoiceType1.Update,
                typeof(MeetingRequestMessageType),
                changes.ItemsElementName[0],
                (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.GetType());

            // If the ItemsElementName of Changes is Update and the type of Item is MeetingRequestMessageType, it indicates a meeting 
            // request has been updated on server and synced on client, then requirement MS-OXWSSYNC_R1672 can be captured.
            // Verify MS-OXWSSYNC requirement: MS-OXWSSYNC_R1672
            Site.CaptureRequirementIfIsTrue(
                isMeetingRequestUpdated,
                1672,
                @"[In t:SyncFolderItemsCreateOrUpdateType Complex Type] [The element MeetingRequest] specifies a meeting request message to update in the client message store.");

            // Call GetItem operation to get the parent folder Id of the item that in SyncFolderItems response.
            GetItemType getItemRequest = new GetItemType();
            getItemRequest.ItemIds = new BaseItemIdType[1] { (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.ItemId };
            getItemRequest.ItemShape = new ItemResponseShapeType();
            getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
            GetItemResponseType getItemResponse = this.COREAdapter.GetItem(getItemRequest);

            // Check whether the GetItem operation is executed successfully.
            foreach (ResponseMessageType message in getItemResponse.ResponseMessages.Items)
            {
                Site.Assert.AreEqual<ResponseClassType>(
                        ResponseClassType.Success,
                        message.ResponseClass,
                        string.Format("Get item should be successful! Expected response code: {0}, actual response code: {1}", ResponseCodeType.NoError, message.ResponseCode));
            }

            // Get the item information from GetItem response
            MeetingRequestMessageType[] item = Common.GetItemsFromInfoResponse<MeetingRequestMessageType>(getItemResponse);
            Site.Assert.AreEqual<int>(1, item.Length, "Only one MeetingRequestMessageType item was created, so there should be only 1 item in GetItem response.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSSYNC_R380");

            // If the parent folder Id of the item in GetItem response is same with it in SyncFolderItems response, 
            // it indicates the folder contains the item to synchronize, then requirement MS-OXWSSYNC_R380 can be captured.
            // Verify MS-OXWSSYNC requirement: MS-OXWSSYNC_R380
            Site.CaptureRequirementIfAreEqual<string>(
                item[0].ParentFolderId.Id,
                (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.ParentFolderId.Id,
                380,
                @"[In m:SyncFolderItemsType Complex Type] [The element SyncFolderId] specifies the identity of the folder that contains the items to synchronize.");
            #endregion

            #region Step 6. Client invokes UpdateItem operation to change the IsRead property of the item which updated in Step 4.
            itemId = new ItemIdType[1] { (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.ItemId };
            this.UpdateReadFlag(itemId, this.ConvertReadFlag(itemId));
            #endregion

            #region Step 7. Client invokes SyncFolderItems operation with previous SyncState to sync the operation result in Step 6.
            responseMessage = this.GetResponseMessage(sentItemsFolder, responseMessage, DefaultShapeNamesType.Default);

            // Assert the changes in response is not null
            Site.Assert.IsNotNull(responseMessage.Changes, "There is one item updated on server, so the changes between server and client should not be null");
            SyncFolderItemsChangesType changesAfterUpdateReadFlag = responseMessage.Changes;

            // Assert both the Items and ItemsElementName are not null
            Site.Assert.IsNotNull(changesAfterUpdateReadFlag.ItemsElementName, "There should be changes information returned in SyncFolderItems response since there is one item updated on server.");
            Site.Assert.IsNotNull(changesAfterUpdateReadFlag.Items, "There should be item information returned in SyncFolderItems response since there is one item updated on server.");

            Site.Assert.AreEqual<int>(1, changesAfterUpdateReadFlag.Items.Length, "Just one MeetingRequestMessageType item was updated in previous step, so the count of Items array in responseMessage.Changes should be 1.");
            #endregion

            #region Step 8. Client invokes DeleteItem operation to delete the item which updated in Step 6.
            bool isDeleted = this.SYNCSUTControlAdapter.FindAndDeleteItem(
                Common.GetConfigurationPropertyValue("User1Name", this.Site),
                Common.GetConfigurationPropertyValue("User1Password", this.Site),
                Common.GetConfigurationPropertyValue("Domain", this.Site),
                sentItemsFolder.ToString(),
                newItemSubject,
                Item.MeetingRequest.ToString());
            Site.Assert.IsTrue(isDeleted, string.Format("The item named '{0}' should be deleted from folder '{1}' successfully.", newItemSubject, sentItemsFolder));
            #endregion

            #region Step 9. Client invokes SyncFolderItems operation with previous SyncState to sync the operation result in Step 8 and verify related requirements.
            responseMessage = this.GetResponseMessage(sentItemsFolder, responseMessage, DefaultShapeNamesType.Default);

            // Assert the changes in response is not null
            Site.Assert.IsNotNull(responseMessage.Changes, "There is one item deleted on server, so the changes between server and client should not be null");
            SyncFolderItemsChangesType changesAfterDelete = responseMessage.Changes;

            // Assert both the Items and ItemsElementName are not null
            Site.Assert.IsNotNull(changesAfterDelete.ItemsElementName, "There should be changes information returned in SyncFolderItems response since there is one item deleted on server.");
            Site.Assert.IsNotNull(changesAfterDelete.Items, "There should be item information returned in SyncFolderItems response since there is one item deleted on server.");

            Site.Assert.AreEqual<int>(1, changesAfterDelete.Items.Length, "Just one MeetingRequestMessageType item was deleted in previous step, so the count of Items array in responseMessage.Changes should be 1.");
            Site.Assert.AreEqual<int>(1, changesAfterDelete.ItemsElementName.Length, "Just one MeetingRequestMessageType item was deleted in previous step, so the count of ItemsElementName array in responseMessage.Changes should be 1.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSSYNC_R184");

            // Verify MS-OXWSSYNC requirement: MS-OXWSSYNC_R184
            Site.CaptureRequirementIfAreEqual<string>(
                (changesAfterUpdateReadFlag.Items[0] as SyncFolderItemsReadFlagType).ItemId.Id,
                (changesAfterDelete.Items[0] as SyncFolderItemsDeleteType).ItemId.Id,
                184,
                @"[In t:SyncFolderItemsDeleteType Complex Type] [The element ItemId] specifies the identifier of the item to delete from the client message store.");

            bool isIncrementalSync = changesAfterDelete.ItemsElementName[0] == ItemsChoiceType1.Delete && responseMessage.SyncState != null;

            // If the ItemsElementName is Delete and the SyncState element is not null, then requirement MS-OXWSSYNC_R504 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSSYNC_R504");

            // Verify MS-OXWSSYNC requirement: MS-OXWSSYNC_R504
            Site.CaptureRequirementIfIsTrue(
                isIncrementalSync,
                504,
                @"[In Abstract Data Model]  If the SyncState element of the SyncFolderItemsType complex type (section 3.1.4.2.3.8) is included in a SyncFolderItems operation (section 3.1.4.2), the server MUST return incremental synchronization information from the last synchronization request.");
            #endregion

            #region Step 10 Clean up the mailbox of attendee.
            this.CleanupAttendeeMailbox();
            #endregion
        }
        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
        }
        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 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 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
        }
        public void MSOXWSCORE_S01_TC09_VerifyItemWithWithAllElement()
        {
            #region Step 1: Create the item.
            ItemType[] items = new ItemType[1];
            items[0] = this.CreateFullPropertiesItem();

            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.inbox, items);

            // 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 item.
            GetItemType getItem = new GetItemType();
            GetItemResponseType getItemResponse = new GetItemResponseType();

            // The Item properties returned.
            getItem.ItemShape = new ItemResponseShapeType();
            getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
            List<PathToUnindexedFieldType> pathToUnindexedFields = new List<PathToUnindexedFieldType>();
            if (Common.IsRequirementEnabled(1354, this.Site))
            {
                PathToUnindexedFieldType pathToUnindexedField = new PathToUnindexedFieldType();
                pathToUnindexedField.FieldURI = UnindexedFieldURIType.itemPreview;
                pathToUnindexedFields.Add(pathToUnindexedField);
            }

            if (Common.IsRequirementEnabled(1731, this.Site))
            {
                PathToUnindexedFieldType pathToUnindexedField = new PathToUnindexedFieldType();
                pathToUnindexedField.FieldURI = UnindexedFieldURIType.itemTextBody;
                pathToUnindexedFields.Add(pathToUnindexedField);
            }

            if (pathToUnindexedFields.Count > 0)
            {
                getItem.ItemShape.AdditionalProperties = pathToUnindexedFields.ToArray();
            }

            // The item to get.
            getItem.ItemIds = createdItemIds;

            getItemResponse = this.COREAdapter.GetItem(getItem);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

            ItemType[] getItems = Common.GetItemsFromInfoResponse<ItemType>(getItemResponse);

            // One item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 getItems.GetLength(0),
                 "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItems.GetLength(0));

            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            ItemIdType[] itemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);
            ItemIdId itemIdId = this.ITEMIDAdapter.ParseItemId(itemIds[0]);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSITEMID_R63");

            // Verify MS-OXWSITEMID requirement: MS-OXWSITEMID_R63
            Site.CaptureRequirementIfAreEqual<IdStorageType>(
               IdStorageType.MailboxItemMailboxGuidBased,
               itemIdId.StorageType,
               "MS-OXWSITEMID",
               63,
               @"[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,]
                }");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R156");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R156
            this.Site.CaptureRequirementIfAreEqual<string>(
                createdItemIds[0].Id,
                getItems[0].ItemId.Id,
                156,
                @"[In t:ItemIdType Complex Type] [The attribute ""Id""] Specifies an item identifier.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R298");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R298
            // The created item was got successfully, so R298 can be captured.
            this.Site.CaptureRequirement(
                298,
                @"[In m:CreateItemType Complex Type] [The element ""SavedItemFolderId""] Specifies the folder in which new items are saved.");
            #endregion

            #region Capture Code

            // Verify the ItemIdType.
            this.VerifyItemIdType(getItems[0].ItemId);

            // Verify the FolderIdType.
            this.VerifyFolderIdType(getItems[0].ParentFolderId);

            // Verify the ItemClassType.
            this.VerifyItemClassType(getItems[0].ItemClass, items[0].ItemClass);

            // Verify the Subject.
            this.VerifySubject(getItems[0].Subject, items[0].Subject);

            // Verify the SensitivityChoicesType.
            this.VerifySensitivityChoicesType(getItems[0].Sensitivity, items[0].Sensitivity);

            // Verify the BodyType.
            this.VerifyBodyType(getItems[0].Body, items[0].Body);

            // Verify the ArrayOfStringsType.
            this.VerifyArrayOfStringsType(getItems[0].Categories, items[0].Categories);

            // Verify the ImportanceChoicesType.
            this.VerifyImportanceChoicesType(getItems[0].ImportanceSpecified, getItems[0].Importance, items[0].Importance);

            // Verify the InReplyTo.
            this.VerifyInReplyTo(getItems[0].InReplyTo, items[0].InReplyTo);

            // Verify the NonEmptyArrayOfResponseObjectsType.
            this.VerifyNonEmptyArrayOfResponseObjectsType(getItems[0].ResponseObjects);

            // Verify the ReminderDueBy.
            this.VerifyReminderDueBy(getItems[0].ReminderDueBySpecified, getItems[0].ReminderDueBy, items[0].ReminderDueBy);

            // Verify the ReminderIsSet.
            this.VerifyReminderIsSet(getItems[0].ReminderIsSetSpecified);

            // Verify the DisplyTo.
            this.VerifyDisplayTo(getItems[0].DisplayTo);

            // Verify the DisplyCc.
            this.VerifyDisplayCc(getItems[0].DisplayCc);

            // Verify the Culture.
            this.VerifyCulture(getItems[0].Culture, items[0].Culture);

            // Verify the LastModifiedName.
            this.VerifyLastModifiedName(getItems[0].LastModifiedName, Common.GetConfigurationPropertyValue("User1Name", this.Site));

            // Verify the EffectiveRightsType.
            this.VerifyEffectiveRightsType(getItems[0].EffectiveRights);

            // Verify the FlagType.
            this.VerifyFlagType(getItems[0].Flag);

            // Verify the Preview.
            this.VerifyPreview(getItems[0].Preview, getItems[0].Body.Value);

            // Verify the TextBody.
            this.VerifyTextBody(getItems[0].TextBody);

            // Verify the InstanceKey.
            this.VerifyInstanceKey(getItems[0].InstanceKey);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1315");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1315
            Site.CaptureRequirementIfIsTrue(
                getItems[0].DateTimeReceivedSpecified,
                1315,
                @"[In t:ItemType Complex Type] The type of DateTimeReceived is xs:dateTime [XMLSCHEMA2].");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1316");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1316
            Site.CaptureRequirementIfIsTrue(
                getItems[0].SizeSpecified,
                1316,
                @"[In t:ItemType Complex Type] The type of Size is xs:int [XMLSCHEMA2].");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1320");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1320
            Site.CaptureRequirementIfIsTrue(
                getItems[0].IsSubmittedSpecified,
                1320,
                @"[In t:ItemType Complex Type] The type of IsSubmitted is xs:boolean [XMLSCHEMA2].");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1607");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1607
            Site.CaptureRequirementIfIsFalse(
                getItems[0].IsSubmitted,
                1607,
                @"[In t:ItemType Complex Type] otherwise [IsSubmitted is] false, indicates [an item has not been submitted to the folder].");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1321");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1321
            Site.CaptureRequirementIfIsTrue(
                getItems[0].IsDraftSpecified,
                1321,
                @"[In t:ItemType Complex Type] The type of IsDraft is xs:boolean.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1322");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1322
            Site.CaptureRequirementIfIsTrue(
                getItems[0].IsFromMeSpecified,
                1322,
                @"[In t:ItemType Complex Type] The type of IsFromMe is xs:boolean.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1611");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1611
            Site.CaptureRequirementIfIsFalse(
                getItems[0].IsFromMe,
                1611,
                @"[In t:ItemType Complex Type] otherwise [IsFromMe is] false, indicates [a user does not sent an item to himself or herself].");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1323");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1323
            Site.CaptureRequirementIfIsTrue(
                getItems[0].IsResendSpecified,
                1323,
                @"[In t:ItemType Complex Type] The type of IsResend is xs:boolean.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1613");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1613
            Site.CaptureRequirementIfIsFalse(
                getItems[0].IsResend,
                1613,
                @"[In t:ItemType Complex Type] otherwise [IsResend is] false, indicates [an item has not previously been sent].");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1324");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1324
            Site.CaptureRequirementIfIsTrue(
                getItems[0].IsUnmodifiedSpecified,
                1324,
                @"[In t:ItemType Complex Type] The type of IsUnmodified is xs:boolean.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1326");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1326
            Site.CaptureRequirementIfIsTrue(
                getItems[0].DateTimeSentSpecified,
                1326,
                @"[In t:ItemType Complex Type] The type of DateTimeSent is xs:dateTime.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1327");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1327
            Site.CaptureRequirementIfIsTrue(
                getItems[0].DateTimeCreatedSpecified,
                1327,
                @"[In t:ItemType Complex Type] The type of DateTimeCreated is xs:dateTime.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1335");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1335
            Site.CaptureRequirementIfIsTrue(
                getItems[0].HasAttachmentsSpecified,
                1335,
                @"[In t:ItemType Complex Type] The type of HasAttachments is xs:boolean.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1340");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1340
            Site.CaptureRequirementIfIsTrue(
                getItems[0].LastModifiedTimeSpecified,
                1340,
                @"[In t:ItemType Complex Type] The type of LastModifiedTime is xs:dateTime.");

            // Verify the ReminderMinutesBeforeStartType schema.
            this.VerifyReminderMinutesBeforeStartType(getItems[0].ReminderMinutesBeforeStart, items[0].ReminderMinutesBeforeStart);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R105");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R105
            // The LastModifiedTimeSpecified is true, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsTrue(
                getItems[0].LastModifiedTimeSpecified,
                105,
                @"[In t:ItemType Complex Type] [The element ""LastModifiedTime""] Specifies an instance of the DateTime structure that represents the date and time when an item was last modified.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R78");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R78
            // The DateTimeReceivedSpecified is true, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsTrue(
                getItems[0].DateTimeReceivedSpecified,
                78,
                @"[In t:ItemType Complex Type] [The element ""DateTimeReceived""] Specifies the date and time that an item was received in a mailbox.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R79");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R79
            // The SizeSpecified is true, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsTrue(
                getItems[0].SizeSpecified,
                79,
                @"[In t:ItemType Complex Type] [The element ""Size""] Specifies an integer value that represents the size of an item, in bytes.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R89");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R89
            // The DateTimeSentSpecified is true, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsTrue(
                getItems[0].DateTimeSentSpecified,
                89,
                @"[In t:ItemType Complex Type] [The element ""DateTimeSent""] Specifies the date and time when an item in a mailbox was sent.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R90");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R90
            // The DateTimeCreatedSpecified is true, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsTrue(
                getItems[0].DateTimeCreatedSpecified,
                90,
                @"[In t:ItemType Complex Type] [The element ""DateTimeCreated""] Specifies the date and time when an item in a mailbox was created.");

            if (Common.IsRequirementEnabled(4003, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R4003");

                // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R4003
                // The IsTruncated is set and the item is created successfully, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    "MS-OXWSCDATA",
                    4003,
                    @"[In Appendix C: Product Behavior] Implementation does use the attribute ""IsTruncated"" with type ""xs:boolean ([XMLSCHEMA2])"" which specifies whether the body is truncated. (Exchange 2013 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(1353, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1353");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1353
                // The RetentionDate is set and the item is created successfully, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    1353,
                    @"[In Appendix C: Product Behavior] Implementation does support element ""RetentionDate"" with type ""xs:dateTime"" which specifies the retention date for an item. (Exchange 2013 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(2281, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1314");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1314
                // The Attachments is set and the item is created successfully, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    1314,
                    @"[In t:ItemType Complex Type] The type of Attachments is t:NonEmptyArrayOfAttachmentsType ([MS-OXWSCDATA] section 2.2.4.43).");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2281");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2281
                // The Attachments is set and the item is created successfully, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    2281,
                    @"[In Appendix C: Product Behavior] Implementation does use the Attachments element which specifies an array of items or files that are attached to an item. (Exchange 2010 SP2 and above follow this behavior.)");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1620");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1620
                this.Site.CaptureRequirementIfIsTrue(
                    getItems[0].HasAttachmentsSpecified && getItems[0].HasAttachments,
                    1620,
                    @"[In t:ItemType Complex Type] [HasAttachments is] True, indicates an item has at least one attachment.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1229");

                // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1229
                this.Site.CaptureRequirement(
                    "MS-OXWSCDATA",
                    1229,
                    @"[In t:NonEmptyArrayOfAttachmentsType Complex Type] The type [NonEmptyArrayOfAttachmentsType] is defined as follow:
 <xs:complexType name=""NonEmptyArrayOfAttachmentsType"">
  <xs:choice
    minOccurs=""1""
    maxOccurs=""unbounded""
  >
    <xs:element name=""ItemAttachment""
      type=""t:ItemAttachmentType""
     />
    <xs:element name=""FileAttachment""
      type=""t:FileAttachmentType""
     />
  </xs:choice>
</xs:complexType>");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1633");

                // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1633
                // The item was created with an item attachment.
                this.Site.CaptureRequirement(
                    "MS-OXWSCDATA",
                    1633,
                    @"[In t:NonEmptyArrayOfAttachmentsType Complex Type] The element ""ItemAttachment"" is ""t:ItemAttachmentType"" type.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1634");

                // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1634
                // The item was created with an file attachment.
                this.Site.CaptureRequirement(
                    "MS-OXWSCDATA",
                    1634,
                    @"[In t:NonEmptyArrayOfAttachmentsType Complex Type] The element ""FileAttachment"" is ""t:FileAttachmentType"" type.");
            }

            if (Common.IsRequirementEnabled(2285, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2285");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2285
                this.Site.CaptureRequirementIfIsTrue(
                    getItems[0].IsAssociatedSpecified,
                    2285,
                    @"[In Appendix C: Product Behavior] Implementation does support the IsAssociated element which specifies a value that indicates whether the item is associated with a folder. (Exchange 2010 and above follow this behavior.)");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1619");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1619
                this.Site.CaptureRequirementIfIsFalse(
                    getItems[0].IsAssociated,
                    1619,
                    @"[In t:ItemType Complex Type] otherwise [IsAssociated is] false, indicates [the item is associated with a folder].");
            }

            if (Common.IsRequirementEnabled(2338, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2338");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2338
                this.Site.CaptureRequirementIfIsNotNull(
                    getItems[0].WebClientReadFormQueryString,
                    2338,
                    @"[In Appendix C: Product Behavior] Implementation does support the WebClientReadFormQueryString element. (Exchange Server 2010 and above follow this behavior.)");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1342");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1342
                // The WebClientReadFormQueryString is returned from server and pass the schema validation, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    1342,
                    @"[In t:ItemType Complex Type] The type of WebClientReadFormQueryString is xs:string.");
            }

            if (Common.IsRequirementEnabled(2283, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2283");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2283
                this.Site.CaptureRequirementIfIsTrue(
                    getItems[0].ReminderNextTimeSpecified,
                    2283,
                    @"[In Appendix C: Product Behavior] Implementation does support the ReminderNextTime element which specifies the date and time for the next reminder. (Exchange 2013 and above follow this behavior.)");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1727");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1727
                // The ReminderNextTime is returned from server and pass the schema validation, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    1727,
                    @"[In t:ItemType Complex Type] The type of ReminderNextTime is xs:dateTime.");
            }

            if (Common.IsRequirementEnabled(2288, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2288");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2288
                this.Site.CaptureRequirementIfIsNotNull(
                    getItems[0].ConversationId,
                    2288,
                    @"[In Appendix C: Product Behavior] Implementation does support the element ""ConversationId"" which specifies the ID of the conversation that an item is part of.. (Exchange 2010 and above follow this behavior.)");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1344");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1344
                // The ConversationId is returned from server and pass the schema validation, so this requirement can be captured.
                this.Site.CaptureRequirement(
                    1344,
                    @"[In t:ItemType Complex Type] The type of ConversationId is t:ItemIdType.");
            }
            #endregion
        }
Пример #9
0
 /// <remarks/>
 public void GetItemAsync(GetItemType GetItem1)
 {
     this.GetItemAsync(GetItem1, null);
 }
        public void MSOXWSCORE_S07_TC17_GetTaskItemWithIconIndexSuccessfully()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(1917, this.Site), "Exchange 2007 and Exchange 2010 do not support the IconIndex element.");

            #region Step 1: Create a recurring task item.
            // Define the pattern and range of the recurring task item.
            DailyRecurrencePatternType pattern = new DailyRecurrencePatternType();
            pattern.Interval = 1;

            NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
            range.NumberOfOccurrences = 5;
            range.StartDate = System.DateTime.Now;

            // Define the TaskType item.
            TaskType[] items = new TaskType[] { new TaskType() };
            items[0].Subject = Common.GenerateResourceName(
                this.Site,
                TestSuiteHelper.SubjectForCreateItem);
            items[0].Recurrence = new TaskRecurrenceType();
            items[0].Recurrence.Item = pattern;
            items[0].Recurrence.Item1 = range;

            // Call CreateItem operation.
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.tasks, items);

            // Check the operation response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            BaseItemIdType[] createdTaskItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);

            // One created task item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 createdTaskItemIds.GetLength(0),
                 "One created task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 createdTaskItemIds.GetLength(0));
            #endregion

            #region Step 2: Get the recurring task item by ItemIdType.
            GetItemType getItem = new GetItemType();

            // Create item and return the item id.
            getItem.ItemIds = createdTaskItemIds;

            // Set the item shape's elements.
            getItem.ItemShape = new ItemResponseShapeType();
            getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
            getItem.ItemShape.AdditionalProperties = new PathToUnindexedFieldType[] { new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemIconIndex } };

            // Call GetItem operation using the created task item ID.
            GetItemResponseType getItemResponse = this.COREAdapter.GetItem(getItem);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
            #endregion

            #region Step 3: Assert the value of IconIndex element is "TaskRecur".
            TaskType[] taskItems = Common.GetItemsFromInfoResponse<TaskType>(getItemResponse);

            // One created item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 taskItems.GetLength(0),
                 "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 taskItems.GetLength(0));

            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1917");
        
            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1917
            this.Site.CaptureRequirementIfAreEqual<IconIndexType>(
                IconIndexType.TaskRecur,
                taskItems[0].IconIndex,
                1917,
                @"[In Appendix C: Product Behavior] Implementation does support value ""TaskRecur"" of ""IconIndex"" simple type which specifies the recurring task icon. (Exchange 2013 and above follow this behavior.)");
            #endregion
        }
        /// <summary>
        /// Call GetItem operation.
        /// </summary>
        /// <param name="itemIds">The ItemIds to be gotten.</param>
        /// <returns>The GetItem response.</returns>
        protected GetItemResponseType CallGetItemOperation(ItemIdType[] itemIds)
        {
            GetItemType getItem = new GetItemType();
            GetItemResponseType getItemResponse = new GetItemResponseType();

            // Set the ItemShape property of GetItem operation's request
            getItem.ItemShape = new ItemResponseShapeType();
            getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;

            // The contact item to get.
            getItem.ItemIds = itemIds;

            getItemResponse = this.CONTAdapter.GetItem(getItem);

            return getItemResponse;
        }
        /// <summary>
        /// Get the items information.
        /// </summary>
        /// <param name="itemIds">The array of item ids.</param>
        /// <returns>The items information.</returns>
        protected ItemType[] GetItems(BaseItemIdType[] itemIds)
        {
            GetItemType getItem = new GetItemType();
            if (itemIds != null)
            {
                getItem.ItemIds = itemIds;
                getItem.ItemShape = new ItemResponseShapeType();
                getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
            }

            // Call GetItem operation
            GetItemResponseType getItemResponse = this.COREAdapter.GetItem(getItem);

            // Check whether the GetItem operation is executed successfully.
            foreach (ResponseMessageType responseMessage in getItemResponse.ResponseMessages.Items)
            {
                Site.Assert.AreEqual<ResponseClassType>(
                    ResponseClassType.Success,
                    responseMessage.ResponseClass,
                    string.Format(
                        "Get items should not be failed! Expected response code: {0}, actual response code: {1}",
                        ResponseCodeType.NoError,
                        responseMessage.ResponseCode));
            }

            // If the operation executes successfully, the items in getItem response should be equal to the value of ItemCount.
            Site.Assert.AreEqual<int>(
                getItemResponse.ResponseMessages.Items.Length,
                this.ItemCount,
                string.Format(
                "The getItem response should contain {0} items, actually it contains {1}",
                this.ItemCount,
                getItemResponse.ResponseMessages.Items.Length));

            // Get the items from successful response.
            ItemType[] getItems = Common.GetItemsFromInfoResponse<ItemType>(getItemResponse);

            return getItems;
        }
        /// <summary>
        /// Get items on the server.
        /// </summary>
        /// <param name="getItemRequest">Specify a request to get items on the server.</param>
        /// <returns>A response to GetItem operation request.</returns>
        public GetItemResponseType GetItem(GetItemType getItemRequest)
        {
            GetItemResponseType response = this.exchangeServiceBinding.GetItem(getItemRequest);
            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.VerifyGetItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            this.VerifyItemId(response);
            return response;
        }
Пример #14
0
        /// <summary>
        /// Define general GetItem request message
        /// </summary>
        /// <param name="itemId">The item identifier of the item.</param>
        /// <param name="baseShape">The basic configuration of properties to be returned in an item response.</param>
        /// <returns>A request to get an item from a mailbox</returns>
        protected GetItemType DefineGeneralGetItemRequestMessage(ItemIdType itemId, DefaultShapeNamesType baseShape)
        {
            GetItemType getItemRequest = new GetItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemId
                },

                ItemShape = new ItemResponseShapeType
                {
                    BaseShape = baseShape,
                }
            };

            return getItemRequest;
        }
        public void MSOXWSCORE_S01_TC25_GetItemWithUniqueBodyEnums()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(2290, this.Site), "Exchange 2007 does not support the UniqueBody element.");

            // Define the count of enumerations.
            int enumCount = 2;
            BodyTypeResponseType[] bodyTypeResponseTypes = new BodyTypeResponseType[enumCount];

            bodyTypeResponseTypes[0] = BodyTypeResponseType.HTML;
            bodyTypeResponseTypes[1] = BodyTypeResponseType.Text;

            // Define an item array to store the items got from GetItem operation response.
            // Each item should contain a BodyTypeResponseType value as its element's value.
            ItemType[] items = new ItemType[enumCount];
            for (int i = 0; i < enumCount; i++)
            {
                BodyTypeResponseType bodyTypeType = bodyTypeResponseTypes[i];

                #region Step 1: Create the item.
                ItemType[] createdItems = new ItemType[] { new ItemType() };
                createdItems[0].Subject = Common.GenerateResourceName(
                    this.Site,
                    TestSuiteHelper.SubjectForCreateItem);

                CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems);

                // 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 item.
                GetItemType getItem = new GetItemType();
                GetItemResponseType getItemResponse = new GetItemResponseType();

                // The Item properties returned
                getItem.ItemShape = new ItemResponseShapeType();
                getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;
                getItem.ItemShape.BodyType = bodyTypeType;
                getItem.ItemShape.BodyTypeSpecified = true;

                // The item to get
                getItem.ItemIds = createdItemIds;

                // Set additional properties.
                getItem.ItemShape.AdditionalProperties = new PathToUnindexedFieldType[]
                {
                    new PathToUnindexedFieldType()
                    { 
                        FieldURI = UnindexedFieldURIType.itemUniqueBody
                    }
                };

                getItemResponse = this.COREAdapter.GetItem(getItem);

                // Check the operation response.
                Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

                ItemType[] getItems = Common.GetItemsFromInfoResponse<ItemType>(getItemResponse);

                // One item should be returned.
                Site.Assert.AreEqual<int>(
                     1,
                     getItems.GetLength(0),
                     "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                     1,
                     getItems.GetLength(0));

                Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

                // Assert the NormalizedBody elements is not null.
                Site.Assert.IsNotNull(getItems[0].UniqueBody, "The UniqueBody element of the item should not be null, actual: {0}.", getItems[0].UniqueBody);

                items[i] = getItems[0];
                #endregion
            }

            #region Step 3: Verify the UniqueBody element.

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1681");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1681
            this.Site.CaptureRequirementIfAreEqual<BodyTypeType>(
                BodyTypeType.HTML,
                items[0].UniqueBody.BodyType1,
                1681,
                @"[In t:ItemType Complex Type] The value  ""HTML"" of ""UniqueBody"" specifies the item body as HTML content.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1682");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1682
            this.Site.CaptureRequirementIfAreEqual<BodyTypeType>(
                BodyTypeType.Text,
                items[1].UniqueBody.BodyType1,
                1682,
                @"[In t:ItemType Complex Type] The value ""Text"" of ""UniqueBody"" specifies the item body as text content.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2290");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2290
            // The element UniqueBody is returned, so this requirement can be captured.
            this.Site.CaptureRequirement(
                2290,
                @"[In Appendix C: Product Behavior] Implementation does support the element ""UniqueBody"" which specifies the body part that is unique to the conversation that an item is part of. (Exchange 2010 and above follow this behavior.)");
            #endregion
        }
        /// <summary>
        /// Get information of specific items.
        /// </summary>
        /// <param name="itemIds">An array of folder identifiers.</param>
        /// <returns>If item information returned successfully.</returns>
        protected bool GetItem(params ItemIdType[] itemIds)
        {
            GetItemType getItemRequest = new GetItemType();

            // The Items properties returned
            getItemRequest.ItemShape = new ItemResponseShapeType();
            getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;

            // The items to get
            getItemRequest.ItemIds = itemIds;
            GetItemResponseType getItemResponse = this.COREAdapter.GetItem(getItemRequest);
            return ResponseClassType.Success == getItemResponse.ResponseMessages.Items[0].ResponseClass;
        }
Пример #17
0
 /// <remarks/>
 public System.IAsyncResult BeginGetItem(GetItemType GetItem1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetItem", new object[] {
             GetItem1}, callback, asyncState);
 }
        /// <summary>
        /// Gets items on the server.
        /// </summary>
        /// <param name="getItemRequest">Specify the request for GetItem operation.</param>
        /// <returns>The response to this operation request.</returns>
        public GetItemResponseType GetItem(GetItemType getItemRequest)
        {
            if (getItemRequest == null)
            {
                throw new ArgumentException("The GetItem request should not be null.");
            }

            // Send the request and get the response.
            GetItemResponseType response = this.exchangeServiceBinding.GetItem(getItemRequest);
            return response;
        }
Пример #19
0
 /// <remarks/>
 public void GetItemAsync(GetItemType GetItem1, object userState)
 {
     if ((this.GetItemOperationCompleted == null))
     {
         this.GetItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetItemOperationCompleted);
     }
     this.InvokeAsync("GetItem", new object[] {
             GetItem1}, this.GetItemOperationCompleted, userState);
 }
 /// <summary>
 /// Get item on the server.
 /// </summary>
 /// <param name="getItemRequest">Get item operation request type.</param>
 /// <returns>Get item operation response type.</returns>
 public GetItemResponseType GetItem(GetItemType getItemRequest)
 {
     GetItemResponseType gitItemResponse = this.exchangeServiceBinding.GetItem(getItemRequest);
     return gitItemResponse;
 }