/// <summary>
        /// Update items on the server.
        /// </summary>
        /// <param name="updateItemRequest">Specify a request to update items on the server.</param>
        /// <returns>A response to this operation request.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            if (updateItemRequest == null)
            {
                throw new ArgumentException("The UpdateItem request should not be null.");
            }

            UpdateItemResponseType response = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

            return(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update tasks on the server according to items' id.
        /// </summary>
        /// <param name="itemIds">The item id of tasks which will be updated.</param>
        /// <returns>The extracted items id array.</returns>
        protected ItemIdType[] UpdateTasks(params ItemIdType[] itemIds)
        {
            // Define the UpdateItem request.
            UpdateItemType updateItemRequest = TestSuiteHelper.GenerateUpdateItemRequest(itemIds);

            // Call the UpdateItem method to update the task items created in previous steps.
            UpdateItemResponseType updateItemResponse = this.TASKAdapter.UpdateItem(updateItemRequest);

            this.VerifyResponseMessage(updateItemResponse);

            // Save the ItemId of task item got from the updateItem response.
            return(Common.GetItemIdsFromInfoResponse(updateItemResponse));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update contact item on the server.
        /// </summary>
        /// <param name="updateItemRequest">The request of UpdateItem operation.</param>
        /// <returns>A response to UpdateItem operation request.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            UpdateItemResponseType updateItemResponse = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

            #region Verify UpdateItem operation requirements

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyUpdateContactItem(this.exchangeServiceBinding.IsSchemaValidated);
            #endregion

            return(updateItemResponse);
        }
        public void MSOXWSCORE_S08_TC05_UpdateTypesOfItemsFailed()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST");

            #region Step 1: Create Items.
            ItemIdType[] createdItemIds = CreateAllTypesItems();
            #endregion

            #region Step 2: Update items.
            // Initialize the change item to update.
            UpdateItemType   updateRequest = new UpdateItemType();
            ItemChangeType[] itemChanges   = new ItemChangeType[createdItemIds.Length];

            // Set two properties (Subject and ReminderMinutesBeforeStart) to update, in order to return an error "ErrorIncorrectUpdatePropertyCount".
            for (int i = 0; i < createdItemIds.Length; i++)
            {
                itemChanges[i]         = new ItemChangeType();
                itemChanges[i].Item    = createdItemIds[i];
                itemChanges[i].Updates = new ItemChangeDescriptionType[1];
                SetItemFieldType setItem1 = new SetItemFieldType();
                setItem1.Item = new PathToUnindexedFieldType()
                {
                    FieldURI = UnindexedFieldURIType.itemSubject
                };
                setItem1.Item1 = new ContactItemType()
                {
                    Subject = Common.GenerateResourceName(
                        this.Site,
                        TestSuiteHelper.SubjectForUpdateItem),
                    ReminderMinutesBeforeStart = TestSuiteHelper.ReminderMinutesBeforeStart
                };
                itemChanges[i].Updates[0] = setItem1;
            }

            updateRequest.ItemChanges = itemChanges;
            updateRequest.MessageDispositionSpecified                    = true;
            updateRequest.MessageDisposition                             = MessageDispositionType.SaveOnly;
            updateRequest.SendMeetingInvitationsOrCancellations          = CalendarItemUpdateOperationType.SendToAllAndSaveCopy;
            updateRequest.SendMeetingInvitationsOrCancellationsSpecified = true;

            // Call UpdateItem to update the Subject and the ReminderMinutesBeforeStart of the created item simultaneously.
            UpdateItemResponseType updateItemResponse = this.COREAdapter.UpdateItem(updateRequest);

            foreach (ResponseMessageType responseMessage in updateItemResponse.ResponseMessages.Items)
            {
                // Verify ResponseCode is ErrorIncorrectUpdatePropertyCount.
                this.VerifyErrorIncorrectUpdatePropertyCount(responseMessage.ResponseCode);
            }
            #endregion
        }
Exemplo n.º 5
0
        /// <summary>
        /// Verify the WSDL port type specifications for the UpdateItem operation and UpdateItemResponseType structure.
        /// </summary>
        /// <param name="updateItemResponse">The response got from server via UpdateItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyUpdateItemOperation(UpdateItemResponseType updateItemResponse, bool isSchemaValidated)
        {
            // If the validation event return any error or warning, the schema validation is false,
            // which indicates the schema is not matched with the expected result.
            // So this requirement can be verified when the isSchemaValidation is true.

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R137
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                137,
                @"[In UpdateItem] The following is the WSDL port type specification of the operation. <wsdl:operation name=""UpdateItem"">
    <wsdl:input message=""tns:UpdateItemSoapIn"" />
    <wsdl:output message=""tns:UpdateItemSoapOut"" />
</wsdl:operation>");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R139
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                139,
                @"[In UpdateItem] The following is the WSDL binding specification of the UpdateItem operation. <wsdl:operation name=""UpdateItem"">
    <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/UpdateItem"" />
    <wsdl:input>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""Impersonation"" use=""literal""/>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""RequestVersion"" use=""literal""/>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""TimeZoneContext"" use=""literal""/>
        <soap:body parts=""request"" use=""literal"" />
    </wsdl:input>
    <wsdl:output>
        <soap:body parts=""UpdateItemResult"" use=""literal"" />
        <soap:header message=""tns:UpdateItemSoapOut"" part=""ServerVersion"" use=""literal""/>
    </wsdl:output>
</wsdl:operation>");

            ItemInfoResponseMessageType item = updateItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;

            if (item.Items.Items[0] is MessageType)
            {
                MessageType messageItem = item.Items.Items[0] as MessageType;
                this.VerifyMessageType(messageItem, isSchemaValidated);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Update the calendar related item elements.
        /// </summary>
        /// <param name="request">A request to the UpdateItem operation.</param>
        /// <returns>The response message returned by UpdateItem operation.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The request of operation 'UpdateItem' should not be null.");
            }

            UpdateItemResponseType updateItemResponse = this.exchangeServiceBinding.UpdateItem(request);

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

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyUpdateItemOperation(updateItemResponse, this.exchangeServiceBinding.IsSchemaValidated);
            return(updateItemResponse);
        }
        /// <summary>
        /// Update items on the server.
        /// </summary>
        /// <param name="updateItemRequest">Specify a request to update items on the server.</param>
        /// <returns>A response to UpdateItem operation request.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            UpdateItemResponseType response = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

            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.VerifyUpdateItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            return(response);
        }
        public void MSOXWSCORE_S08_TC04_UpdateTypesOfItemsSuccessfully()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST");

            #region Step 1: Create Items.
            ItemIdType[] createdItemIds = CreateAllTypesItems();
            #endregion

            #region Step 2: Update items.

            ItemChangeType[] itemChanges = new ItemChangeType[createdItemIds.Length];

            // Set the public properties (Subject) which all the seven kinds of operation have.
            for (int i = 0; i < createdItemIds.Length; i++)
            {
                itemChanges[i]         = new ItemChangeType();
                itemChanges[i].Item    = createdItemIds[i];
                itemChanges[i].Updates = new ItemChangeDescriptionType[]
                {
                    new SetItemFieldType()
                    {
                        Item = new PathToUnindexedFieldType()
                        {
                            FieldURI = UnindexedFieldURIType.itemSubject
                        },

                        Item1 = new ItemType()
                        {
                            Subject = Common.GenerateResourceName(
                                this.Site,
                                TestSuiteHelper.SubjectForUpdateItem)
                        }
                    }
                };
            }

            UpdateItemResponseType updateItemResponse = this.CallUpdateItemOperation(
                DistinguishedFolderIdNameType.drafts,
                true,
                itemChanges);

            // Check the operation response.
            Common.CheckOperationSuccess(updateItemResponse, createdItemIds.Length, this.Site);

            #endregion
        }
Exemplo n.º 9
0
        private void UpdateCalendarItem(ItemChangeType[] changes)
        {
            UpdateItemType updateItemRequest = new UpdateItemType();

            updateItemRequest.ConflictResolution = ConflictResolutionType.AlwaysOverwrite;
            updateItemRequest.ItemChanges        = changes;
            updateItemRequest.SendMeetingInvitationsOrCancellations          = CalendarItemUpdateOperationType.SendToNone;
            updateItemRequest.SendMeetingInvitationsOrCancellationsSpecified = true;

            UpdateItemResponseType response        = Service.UpdateItem(updateItemRequest);
            ResponseMessageType    responseMessage = response.ResponseMessages.Items[0];

            if (responseMessage.ResponseCode != ResponseCodeType.NoError)
            {
                throw new Exception("UpdateItem failed with response code " + responseMessage.ResponseCode);
            }
        }
        /// <summary>
        /// Updates Task items on the server.
        /// </summary>
        /// <param name="updateItemRequest">Specifies a request to update Task items on the server.</param>
        /// <returns>A response to this operation request.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            UpdateItemResponseType updateItemResponse = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

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

            // Verify the update item operation.
            this.VerifyUpdateItemOperation(updateItemResponse, this.exchangeServiceBinding.IsSchemaValidated);

            // Verify Soap version requirements.
            this.VerifySoapVersion();

            // Verify transport requirements.
            this.VerifyTransportType();

            return(updateItemResponse);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Sets the message importance flag.
        /// </summary>
        public void SetMessageImportance(ItemIdType messageId, bool isStarred)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var setField = new SetItemFieldType
            {
                Item1 = new MessageType {
                    Importance = isStarred ? ImportanceChoicesType.High : ImportanceChoicesType.Normal, ImportanceSpecified = true
                },
                Item = new PathToUnindexedFieldType {
                    FieldURI = UnindexedFieldURIType.itemImportance
                }
            };

            var updatedItems = new[]
            {
                new ItemChangeType
                {
                    Updates = new ItemChangeDescriptionType[] { setField },
                    Item    = messageId
                }
            };

            var request = new UpdateItemType
            {
                ItemChanges                 = updatedItems,
                ConflictResolution          = ConflictResolutionType.AutoResolve,
                MessageDisposition          = MessageDispositionType.SaveOnly,
                MessageDispositionSpecified = true
            };

            UpdateItemResponseType updateItemResponse = binding.UpdateItem(request);

            if (updateItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(updateItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Verify the WSDL port type specifications for the UpdateItem operation and UpdateItemResponseType structure. 
        /// </summary>
        /// <param name="response">The response message of UpdateItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyUpdateItemOperation(UpdateItemResponseType response, bool isSchemaValidated)
        {
            Site.Assert.IsTrue(isSchemaValidated, "The schema validation should be true.");

            // Verify the WSDL port type specifications for the UpdateItem operation
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R451");

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R451
            Site.CaptureRequirementIfIsTrue(
             isSchemaValidated,
             451,
             @"[In UpdateItem operation] The following is the WSDL port type specification for the UpdateItem operation. 
<wsdl:operation name=""UpdateItem"">
     <wsdl:input message=""tns:UpdateItemSoapIn"" />
     <wsdl:output message=""tns:UpdateItemSoapOut"" />
</wsdl:operation>");

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

            this.Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                645,
                @"[In UpdateItem Operation] The following is the WSDL binding specification for the UpdateItem operation.
<wsdl:operation name=""UpdateItem"">
   <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/UpdateItem""/>
   <wsdl:input>
      <soap:header message=""tns:UpdateItemSoapIn"" part=""Impersonation"" use=""literal""/>
      <soap:header message=""tns:UpdateItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
      <soap:header message=""tns:UpdateItemSoapIn"" part=""RequestVersion"" use=""literal""/>
      <soap:header message=""tns:UpdateItemSoapIn"" part=""TimeZoneContext"" use=""literal""/>
      <soap:body parts=""request"" use=""literal""/>
   </wsdl:input>
   <wsdl:output>
      <soap:body parts=""UpdateItemResult"" use=""literal""/>
      <soap:header message=""tns:UpdateItemSoapOut"" part=""ServerVersion"" use=""literal""/>
   </wsdl:output>
</wsdl:operation>");

            // Verify calendar related items
            foreach (ResponseMessageType respMsg in response.ResponseMessages.Items)
            {
                if (respMsg.ResponseClass == ResponseClassType.Success)
                {
                    UpdateItemResponseMessageType updateItemInfo = respMsg as UpdateItemResponseMessageType;
                    if (updateItemInfo.Items.Items != null)
                    {
                        // Each ItemInfoResponseMessageType contains one calendar related item for UpdateItem operation.
                        ItemType item = updateItemInfo.Items.Items[0];
                        this.VerifyItemTypeItems(item, isSchemaValidated);
                    }
                }
            }
        }
        /// <summary>
        /// Update item on the server.
        /// </summary>
        /// <param name="updateItemRequest">Update item operation request type.</param>
        /// <returns>Update item operation response type.</returns>
        public UpdateItemResponseType UpdateItem(UpdateItemType updateItemRequest)
        {
            UpdateItemResponseType updateItemResponse = this.exchangeServiceBinding.UpdateItem(updateItemRequest);

            return(updateItemResponse);
        }
        public void MSOXWSMSG_S02_TC01_UpdateMessage()
        {
            #region Create message
            CreateItemType         createItemRequest  = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts);
            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);

            // Save the ItemId of message responseMessageItem returned from the createItem response.
            ItemIdType itemIdType = new ItemIdType();
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            itemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;
            #endregion

            #region update ToRecipients property of the original message
            UpdateItemType updateItemRequest = new UpdateItemType
            {
                MessageDisposition          = MessageDispositionType.SaveOnly,
                MessageDispositionSpecified = true,

                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType
                    {
                        Item = itemIdType,

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType
                            {
                                Item = new PathToUnindexedFieldType
                                {
                                    FieldURI = UnindexedFieldURIType.messageToRecipients
                                },

                                // Update the ToRecipients of message from Recipient1 to Recipient2.
                                Item1 = new MessageType
                                {
                                    ToRecipients = new EmailAddressType[]
                                    {
                                        new EmailAddressType
                                        {
                                            EmailAddress = this.Recipient2
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(updateItemResponse), @"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 ItemId of message responseMessageItem got from the UpdateItem response.
            if (this.firstItemOfFirstInfoItem != null)
            {
                Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
                itemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
                itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;
            }

            #region Verify the requirements about UpdateItem
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R143");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R143
            Site.CaptureRequirementIfIsNotNull(
                updateItemResponse,
                143,
                @"[In UpdateItem] The protocol client sends an UpdateItemSoapIn request WSDL message, and the protocol server responds with an UpdateItemSoapOut response WSDL message.");

            Site.Assert.IsNotNull(this.infoItems[0].ResponseClass, @"The ResponseClass property of the first item of infoItems instance should not be null.");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R144
            Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                this.infoItems[0].ResponseClass,
                144,
                @"[In UpdateItem] If the UpdateItem WSDL operation request is successful, the server returns an UpdateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.9.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the UpdateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". ");

            Site.Assert.IsNotNull(this.infoItems[0].ResponseCode, @"The ResponseCode property of the first item of infoItems instance should not be null.");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R145
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.NoError,
                this.infoItems[0].ResponseCode,
                145,
                @"[In UpdateItem] [A successful UpdateItem operation request returns an UpdateItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the UpdateItemResponseMessage element is set to ""NoError"". ");
            #endregion
            #endregion

            #region Get the updated message
            GetItemType         getItemRequest  = DefineGeneralGetItemRequestMessage(itemIdType, DefaultShapeNamesType.AllProperties);
            GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(getItemResponse);
            Site.Assert.IsNotNull(this.infoItems, @"The GetItem response should contain one or more items of ItemInfoResponseMessageType.");
            ItemType updatedItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(updatedItem, @"The updated message should exist");

            string expectedValue = Common.GetConfigurationPropertyValue("Recipient2", this.Site);
            Site.Assert.AreEqual <string>(
                expectedValue.ToLower(),
                updatedItem.DisplayTo.ToLower(),
                string.Format("The expected value of the DisplayTo property is {0}. The actual value is {1}.", expectedValue, updatedItem.DisplayTo));
            #endregion

            #region Clean up Sender's drafts folder
            bool isClear = this.MSGSUTControlAdapter.CleanupFolders(
                Common.GetConfigurationPropertyValue("Sender", this.Site),
                Common.GetConfigurationPropertyValue("SenderPassword", this.Site),
                this.Domain,
                this.Subject,
                "drafts");
            Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up.");
            #endregion
        }
Exemplo n.º 15
0
        /// <summary>
        /// Verify the UpdateItemResponseType structure.
        /// </summary>
        /// <param name="updateItemResponse">An UpdateItemResponseType instance.</param>
        /// <param name="isSchemaValidated">Indicate whether schema is verified.</param>
        private void VerifyUpdateItemResponse(UpdateItemResponseType updateItemResponse, bool isSchemaValidated)
        {
            Site.Assert.IsTrue(isSchemaValidated, "The schema should be validated.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R467
            Site.CaptureRequirementIfIsNotNull(
                updateItemResponse,
                467,
                @"[In UpdateItem Operation] The following is the WSDL port type specification for the UpdateItem operation:
                    <wsdl:operation name=""UpdateItem"">
                       <wsdl:input message=""tns:UpdateItemSoapIn""/>
                       <wsdl:output message=""tns:UpdateItemSoapOut""/>
                    </wsdl:operation>");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R468
            Site.CaptureRequirementIfIsNotNull(
                updateItemResponse,
                468,
                @"[In UpdateItem Operation] The following is the WSDL binding specification for the UpdateItem operation: 
                    <wsdl:operation name=""UpdateItem"">
                       <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/UpdateItem""/>
                       <wsdl:input>
                          <soap:header message=""tns:UpdateItemSoapIn"" part=""Impersonation"" use=""literal""/>
                          <soap:header message=""tns:UpdateItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
                          <soap:header message=""tns:UpdateItemSoapIn"" part=""RequestVersion"" use=""literal""/>
                          <soap:header message=""tns:UpdateItemSoapIn"" part=""TimeZoneContext"" use=""literal""/>
                          <soap:body parts=""request"" use=""literal""/>
                       </wsdl:input>
                       <wsdl:output>
                          <soap:body parts=""UpdateItemResult"" use=""literal""/>
                          <soap:header message=""tns:UpdateItemSoapOut"" part=""ServerVersion"" use=""literal""/>
                       </wsdl:output>
                    </wsdl:operation>");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R484
            Site.CaptureRequirementIfIsNotNull(
                updateItemResponse,
                484,
                @"[In tns:UpdateItemSoapOut Message] [The UpdateItemSoapOut WSDL message is defined as:]
                    <wsdl:message name=""UpdateItemSoapOut"">
                       <wsdl:part name=""UpdateItemResult"" element=""tns:UpdateItemResponse""/>
                       <wsdl:part name=""ServerVersion"" element=""t:ServerVersionInfo""/>
                    </wsdl:message>");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1464
            Site.CaptureRequirementIfIsNotNull(
                updateItemResponse,
                1464,
                @"[In tns:UpdateItemSoapOut Message] The type of UpdateItemResult is tns:UpdateItemResponse (section 3.1.4.9.2.2).");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R487
            // According to the schema, updateItemResponse is the SOAP body of a response message returned by server, 
            // this requirement can be verified directly.
            Site.CaptureRequirement(
                487,
                @"[In tns:UpdateItemSoapOut Message] [The part ""UpdateItemResult""] Specifies the SOAP body of a response message.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1465
            Site.CaptureRequirementIfIsNotNull(
                this.exchangeServiceBinding.ServerVersionInfoValue,
                1465,
                @"[In tns:UpdateItemSoapOut Message] The type of ServerVersion is t:ServerVersionInfo ([MS-OXWSCDATA] section 2.2.5.10).");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R488
            // According to the schema, ServerVersion is the SOAP header that contains the server version information, 
            // this requirement can be verified directly.
            Site.CaptureRequirement(
                488,
                @"[In tns:UpdateItemSoapOut Message] [The part ""ServerVersion"" with element ""t:ServerVersionInfo""] Specifies a SOAP header that identifies the server version for a response to an UpdateItem operation request.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R495
            Site.CaptureRequirementIfIsNotNull(
                updateItemResponse,
                495,
                @"[In m:UpdateItemResponse Element] [The UpdateItemResponse element is defined as:]
                    <xs:element name=""UpdateItemResponse""
                      type=""m:UpdateItemResponseType""
                     />");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R509
            Site.CaptureRequirementIfIsNotNull(
                updateItemResponse,
                509,
                @"[In m:UpdateItemResponseType Complex Type] [The UpdateItemResponseType complex type is defined as:] 
                    <xs:complexType name=""UpdateItemResponseType"">
                      <xs:complexContent>
                        <xs:extension
                          base=""m:BaseResponseMessageType""
                         />
                      </xs:complexContent>
                    </xs:complexType>");

            // Verify the BaseResponseMessageType schema.
            this.VerifyBaseResponseMessageType(updateItemResponse);

            foreach (UpdateItemResponseMessageType message in updateItemResponse.ResponseMessages.Items)
            {
                this.VerifyUpdateItemResponseMessageType(message);
            }

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R218
            // The request of UpdateItem operation is formed according to schema
            // And the response of UpdateItem operation is returned by server according to schema
            // This requirement can be verified directly.
            Site.CaptureRequirement(
                218,
                @"[In Message Processing Events and Sequencing Rules] [The operation ""UpdateItem""] Updates items on the server.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R466
            // The request of UpdateItem operation is formed according to schema
            // And the response of UpdateItem operation is returned by server according to schema
            // This requirement can be verified directly.
            Site.CaptureRequirement(
                466,
                @"[In UpdateItem Operation] The UpdateItem operation updates items on the server.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R491
            // This requirement can be captured directly, since UpdateItemResponse is the response of a UpdateItem operation request.
            Site.CaptureRequirement(
                491,
                @"[In Elements] [The element ""UpdateItemResponse""] Specifies a response to an UpdateItem operation request.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R494
            // This requirement can be captured directly, since UpdateItemResponse is the response of a UpdateItem operation request.
            Site.CaptureRequirement(
                494,
                @"[In m:UpdateItemResponse Element] The UpdateItemResponse element specifies a response to an UpdateItem operation request.");
        }
Exemplo n.º 16
0
        /// <summary>
        /// Verify the UpdateItemResponseType structure.
        /// </summary>
        /// <param name="updateItemResponse">The response got from server via UpdateItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyUpdateItemOperation(UpdateItemResponseType updateItemResponse, bool isSchemaValidated)
        {
            // If the validation event return any error or warning, the schema validation is false, 
            // which indicates the schema is not matched with the expected result. 
            // So these requirement can be verified when the isSchemaValidation is true.

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R191        
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                191,
                @"[In UpdateItem Operation] The following is the WSDL port type specification for the UpdateItem operation. <wsdl:operation name=""UpdateItem"">
                   <wsdl:input message=""tns:UpdateItemSoapIn"" />
                   <wsdl:output message=""tns:UpdateItemSoapOut""/>
                </wsdl:operation>");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R193 
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                193,
                @"[In UpdateItem Operation] The following is the WSDL binding specification for the UpdateItem operation. <wsdl:operation name=""UpdateItem"">
                   <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/UpdateItem""/>
                   <wsdl:input>
                      <soap:header message=""tns:UpdateItemSoapIn"" part=""Impersonation"" use=""literal""/>
                      <soap:header message=""tns:UpdateItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
                      <soap:header message=""tns:UpdateItemSoapIn"" part=""RequestVersion"" use=""literal""/>
                      <soap:header message=""tns:UpdateItemSoapIn"" part=""TimeZoneContext"" use=""literal""/>
                      <soap:body parts=""request"" use=""literal""/>
                   </wsdl:input>
                   <wsdl:output>
                      <soap:body parts=""UpdateItemResult"" use=""literal""/>
                      <soap:header message=""tns:UpdateItemSoapOut"" part=""ServerVersion"" use=""literal""/>
                   </wsdl:output>
                </wsdl:operation>");

            if (updateItemResponse.ResponseMessages.Items != null && updateItemResponse.ResponseMessages.Items.Length > 0)
            {
                foreach (ItemInfoResponseMessageType itemInfo in updateItemResponse.ResponseMessages.Items)
                {
                    if (itemInfo.ResponseClass == ResponseClassType.Success)
                    {
                        this.VerifyTaskType(isSchemaValidated, itemInfo);
                    }
                }
            }
        }
Exemplo n.º 17
0
        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
        }
Exemplo n.º 18
0
        public void MSOXWSCONT_S05_TC01_OperateMultipleContactItems()
        {
            #region Step 1:Create the contact item.
            CreateItemType createItemRequest = new CreateItemType();

            #region Config the contact items
            createItemRequest.Items       = new NonEmptyArrayOfAllItemsType();
            createItemRequest.Items.Items = new ContactItemType[2];

            // Create the first contact item.
            createItemRequest.Items.Items[0] = this.BuildContactItemWithRequiredProperties();

            // Create the second contact item.
            createItemRequest.Items.Items[1] = this.BuildContactItemWithRequiredProperties();

            // Configure the SavedItemFolderId of CreateItem request to specify that the created item is saved under which folder.
            createItemRequest.SavedItemFolderId = new TargetFolderIdType()
            {
                Item = new DistinguishedFolderIdType()
                {
                    Id = DistinguishedFolderIdNameType.contacts,
                }
            };
            #endregion

            CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 2, this.Site);
            #endregion

            #region Step 2:Update the contact items.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    },
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[1],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastCommaFirst.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateItemResponse, 2, this.Site);
            #endregion

            #region Step 3:Move the contact items.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[2];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];
            moveItemRequest.ItemIds[1] = this.ExistContactItems[1];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 2, this.Site);
            #endregion

            #region Step 4:Get the contact items.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

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

            #region Step 5:Copy the contact items.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[2];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];
            copyItemRequest.ItemIds[1] = this.ExistContactItems[1];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 2, this.Site);
            #endregion
        }
        public void MSOXWSCONT_S02_TC01_UpdateContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

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

            #region Step 2:Update the contact item.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

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

            #region Step 3:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

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

            ContactItemType[] contacts = Common.GetItemsFromInfoResponse <ContactItemType>(getItemResponse);

            Site.Assert.AreEqual <int>(
                1,
                contacts.Length,
                string.Format(
                    "The count of items from response should be 1, actual: '{0}'.", contacts.Length));

            Site.Assert.AreEqual <string>(
                FileAsMappingType.LastFirstCompany.ToString(),
                contacts[0].FileAs,
                string.Format(
                    "The FileAs property should be updated as set. Expected value: {0}, actual value: {1}", FileAsMappingType.LastFirstCompany.ToString(), contacts[0].FileAs));
            #endregion
        }
Exemplo n.º 20
0
        /// <summary>
        /// Verify the WSDL port type specifications for the UpdateItem operation and UpdateItemResponseType structure. 
        /// </summary>
        /// <param name="updateItemResponse">The response got from server via UpdateItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyUpdateItemOperation(UpdateItemResponseType updateItemResponse, bool isSchemaValidated)
        {
            // If the validation event return any error or warning, the schema validation is false, 
            // which indicates the schema is not matched with the expected result. 
            // So this requirement can be verified when the isSchemaValidation is true.

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R137            
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                137,
                @"[In UpdateItem] The following is the WSDL port type specification of the operation. <wsdl:operation name=""UpdateItem"">
    <wsdl:input message=""tns:UpdateItemSoapIn"" />
    <wsdl:output message=""tns:UpdateItemSoapOut"" />
</wsdl:operation>");

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

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R139            
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                139,
                @"[In UpdateItem] The following is the WSDL binding specification of the UpdateItem operation. <wsdl:operation name=""UpdateItem"">
    <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/UpdateItem"" />
    <wsdl:input>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""Impersonation"" use=""literal""/>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""RequestVersion"" use=""literal""/>
        <soap:header message=""tns:UpdateItemSoapIn"" part=""TimeZoneContext"" use=""literal""/>
        <soap:body parts=""request"" use=""literal"" />
    </wsdl:input>
    <wsdl:output>
        <soap:body parts=""UpdateItemResult"" use=""literal"" />
        <soap:header message=""tns:UpdateItemSoapOut"" part=""ServerVersion"" use=""literal""/>
    </wsdl:output>
</wsdl:operation>");

            ItemInfoResponseMessageType item = updateItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;
            if (item.Items.Items[0] is MessageType)
            {
                MessageType messageItem = item.Items.Items[0] as MessageType;
                this.VerifyMessageType(messageItem, isSchemaValidated);
            }
        }
Exemplo n.º 21
0
        public void MSOXWSCONT_S06_TC01_OperateContactItemWithoutOptionalElements()
        {
            #region Step 1:Create the contact item.
            // Create a contact item without optional elements.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

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

            #region Step 2:Update the contact item.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

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

            #region Step 3:Move the contact item.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

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

            #region Step 4:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

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

            #region Step 5:Copy the contact item.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[1];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            #endregion
        }
        public void MSOXWSCONT_S02_TC01_UpdateContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

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

            #region Step 2:Update the contact item.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

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

            #region Step 3:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

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

            ContactItemType[] contacts = Common.GetItemsFromInfoResponse<ContactItemType>(getItemResponse);

            Site.Assert.AreEqual<int>(
                1,
                contacts.Length,
                string.Format(
                    "The count of items from response should be 1, actual: '{0}'.", contacts.Length));

            Site.Assert.AreEqual<string>(
                FileAsMappingType.LastFirstCompany.ToString(),
                contacts[0].FileAs,
                string.Format(
                    "The FileAs property should be updated as set. Expected value: {0}, actual value: {1}", FileAsMappingType.LastFirstCompany.ToString(), contacts[0].FileAs));
            #endregion
        }