public void MSOXCROPS_S11_TC05_TestRopSynchronizationImportDeletes()
        {
            this.CheckTransportIsSupported();

            this.cropsAdapter.RpcConnect(
                Common.GetConfigurationPropertyValue("SutComputerName", this.Site),
                ConnectionType.PrivateMailboxServer,
                Common.GetConfigurationPropertyValue("UserEssdn", this.Site),
                Common.GetConfigurationPropertyValue("Domain", this.Site),
                Common.GetConfigurationPropertyValue("AdminUserName", this.Site),
                Common.GetConfigurationPropertyValue("PassWord", this.Site));

            // Step 1: Open folder.
            #region Open folder

            // Log on to the private mailbox.
            RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);

            RopOpenFolderRequest openFolderRequest;
            RopOpenFolderResponse openFolderResponse;

            // Construct the RopOpenFolder request.
            openFolderRequest.RopId = (byte)RopId.RopOpenFolder;
            
            openFolderRequest.LogonId = TestSuiteBase.LogonId;
            openFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            openFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
            openFolderRequest.FolderId = logonResponse.FolderIds[4];
            openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopOpenFolder request.");

            // Send the RopOpenFolder request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                openFolderRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            openFolderResponse = (RopOpenFolderResponse)response;
            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                openFolderResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success)");

            // Get the handle of opened folder, which will be used as input handle in RopCreateFolder.
            uint openedFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex];

            #endregion

            // Step 2: Configure a synchronization upload context.
            #region Configure a synchronization upload context

            RopSynchronizationOpenCollectorRequest synchronizationOpenCollectorRequest;
            RopSynchronizationOpenCollectorResponse synchronizationOpenCollectorResponse;

            // Construct the RopSynchronizationOpenCollector request.
            synchronizationOpenCollectorRequest.RopId = (byte)RopId.RopSynchronizationOpenCollector;
            synchronizationOpenCollectorRequest.LogonId = TestSuiteBase.LogonId;
            synchronizationOpenCollectorRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            synchronizationOpenCollectorRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
            synchronizationOpenCollectorRequest.IsContentsCollector = Convert.ToByte(TestSuiteBase.Zero);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopSynchronizationOpenCollector request.");

            // Send the RopSynchronizationOpenCollector request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                synchronizationOpenCollectorRequest,
                openedFolderHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            synchronizationOpenCollectorResponse = (RopSynchronizationOpenCollectorResponse)response;
            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                synchronizationOpenCollectorResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success)");
            uint synchronizationUploadContextHandle = responseSOHs[0][synchronizationOpenCollectorResponse.OutputHandleIndex];

            #endregion

            // Step 3: Create message.
            #region Create message

            RopCreateMessageRequest createMessageRequest = new RopCreateMessageRequest();
            RopCreateMessageResponse createMessageResponse;

            // Construct the RopCreateMessage request.
            createMessageRequest.RopId = (byte)RopId.RopCreateMessage;
            createMessageRequest.LogonId = TestSuiteBase.LogonId;
            createMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;

            // Set CodePageId to 0x0FFF, which specified the code page of Logon object will be used.
            createMessageRequest.CodePageId = TestSuiteBase.CodePageId;

            createMessageRequest.FolderId = logonResponse.FolderIds[4];
            createMessageRequest.AssociatedFlag = Convert.ToByte(TestSuiteBase.Zero);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopCreateMessage request.");

            // Send the RopCreateMessage request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                createMessageRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            createMessageResponse = (RopCreateMessageResponse)response;
            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                createMessageResponse.ReturnValue,
                "if ROP succeeds, the ReturnValue of its response is 0(success)");
            uint targetMessageHandle = responseSOHs[0][createMessageResponse.OutputHandleIndex];

            #endregion

            // Step 4: Save message.
            #region Save message

            RopSaveChangesMessageRequest saveChangesMessageRequest;
            RopSaveChangesMessageResponse saveChangesMessageResponse;

            // Construct the RopSaveChangesMessage request.
            saveChangesMessageRequest.RopId = (byte)RopId.RopSaveChangesMessage;
            saveChangesMessageRequest.LogonId = TestSuiteBase.LogonId;
            saveChangesMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            saveChangesMessageRequest.ResponseHandleIndex = TestSuiteBase.ResponseHandleIndex1;
            saveChangesMessageRequest.SaveFlags = (byte)SaveFlags.ForceSave;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSaveChangesMessage request.");

            // Send the RopSaveChangesMessage request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                saveChangesMessageRequest,
                targetMessageHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            saveChangesMessageResponse = (RopSaveChangesMessageResponse)response;
            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                saveChangesMessageResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success).");

            #endregion

            // Send the RopSynchronizationImportDeletes request and verify the response.
            #region RopSynchronizationImportDeletes response

            RopSynchronizationImportDeletesRequest ropSynchronizationImportDeletesRequest = new RopSynchronizationImportDeletesRequest();
            TaggedPropertyValue[] propertyValues = new TaggedPropertyValue[1];
            TaggedPropertyValue propertyValue = new TaggedPropertyValue();

            // Send the RopLongTermIdFromId request to convert a short-term ID into a long-term ID.
            #region RopLongTermIdFromId response

            RopLongTermIdFromIdRequest ropLongTermIdFromIdRequest = new RopLongTermIdFromIdRequest();
            RopLongTermIdFromIdResponse ropLongTermIdFromIdResponse;

            // Construct the RopLongTermIdFromId request.
            ropLongTermIdFromIdRequest.RopId = (byte)RopId.RopLongTermIdFromId;
            ropLongTermIdFromIdRequest.LogonId = TestSuiteBase.LogonId;
            ropLongTermIdFromIdRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            ropLongTermIdFromIdRequest.ObjectId = saveChangesMessageResponse.MessageId;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopGetPropertyIdsFromNames request.");

            // Send the RopGetPropertyIdsFromNames request.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                ropLongTermIdFromIdRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            ropLongTermIdFromIdResponse = (RopLongTermIdFromIdResponse)response;

            #endregion

            byte[] sampleValue = new byte[24];
            propertyValue.PropertyTag.PropertyId = this.propertyDictionary[PropertyNames.PidTagTemplateData].PropertyId;
            propertyValue.PropertyTag.PropertyType = this.propertyDictionary[PropertyNames.PidTagTemplateData].PropertyType;

            // The combination of first two bytes (0x0016) indicates the length of value field.
            sampleValue[0] = 0x16;
            sampleValue[1] = 0x00;
            Array.Copy(ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid, 0, sampleValue, 2, 16);
            Array.Copy(ropLongTermIdFromIdResponse.LongTermId.GlobalCounter, 0, sampleValue, 18, 6);

            propertyValue.Value = sampleValue;
            propertyValues[0] = propertyValue;

            // Construct the RopSynchronizationImportDeletes request.
            ropSynchronizationImportDeletesRequest.RopId = (byte)RopId.RopSynchronizationImportDeletes;
            ropSynchronizationImportDeletesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            ropSynchronizationImportDeletesRequest.LogonId = TestSuiteBase.LogonId;
            ropSynchronizationImportDeletesRequest.IsHierarchy = Convert.ToByte(TestSuiteBase.Zero);
            ropSynchronizationImportDeletesRequest.PropertyValueCount = (ushort)propertyValues.Length;
            ropSynchronizationImportDeletesRequest.PropertyValues = propertyValues;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSynchronizationImportDeletes request to invoke success response.");

            // Send the RopSynchronizationImportDeletes request to get the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                ropSynchronizationImportDeletesRequest,
                synchronizationUploadContextHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);

            // Send the RopSynchronizationImportDeletes request to get the failure response.
            ropSynchronizationImportDeletesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSynchronizationImportDeletes request to invoke failure response.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                ropSynchronizationImportDeletesRequest,
                synchronizationUploadContextHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.FailureResponse);

            #endregion
        }
        /// <summary>
        /// Imports deletions of messages or folders into the server replica.
        /// </summary>
        /// <param name="serverId">A 32-bit signed integer represent the Identity of server</param>
        /// <param name="uploadcontextHandleIndex">Synchronization upload context handle</param>
        /// <param name="objIdIndexes">more object id</param>
        /// <param name="importDeleteFlag">Deletions type</param>
        /// <returns>Indicate the result of this ROP operation.</returns>
        public RopResult SynchronizationImportDeletes(int serverId, int uploadcontextHandleIndex, Sequence<int> objIdIndexes, byte importDeleteFlag)
        {
            // Initialize ROP data.
            uint synchronizationImportDeletesHandle = this.handleContainer[uploadcontextHandleIndex];
            RopResult result = RopResult.InvalidParameter;

            RopSynchronizationImportDeletesRequest synchronizationImportDeletesRequest = new RopSynchronizationImportDeletesRequest();
            RopSynchronizationImportDeletesResponse synchronizationImportDeletesResponse = new RopSynchronizationImportDeletesResponse();

            // Construct the RopSynchronizationImportDeletes request.
            synchronizationImportDeletesRequest.RopId = 0x74;
            synchronizationImportDeletesRequest.InputHandleIndex = 0x00;
            synchronizationImportDeletesRequest.LogonId = 0x00;
            synchronizationImportDeletesRequest.IsHierarchy = (byte)importDeleteFlag;
            this.importDelFlag = importDeleteFlag;
            synchronizationImportDeletesRequest.PropertyValueCount = (ushort)objIdIndexes.Count;
            TaggedPropertyValue[] propertyValues = new TaggedPropertyValue[objIdIndexes.Count];
            for (int i = 0; i < propertyValues.Length; i++)
            {
                TaggedPropertyValue propertyValue = new TaggedPropertyValue();
                PropertyTag[] tagArray = new PropertyTag[1];
                byte[] deleteGidValue = new byte[sizeof(int) + sizeof(short) + GidLength];
                propertyValue.PropertyTag = new PropertyTag(0x0000, 0x1102);

                // The combination of first two bytes (0x0016) indicates the length of value field.
                // The amount of id
                int index = 0;
                Array.Copy(BitConverter.GetBytes(tagArray.Length), 0, deleteGidValue, 0, sizeof(int));
                index += sizeof(int);
                Array.Copy(BitConverter.GetBytes((short)GidLength), 0, deleteGidValue, index, sizeof(short));
                index += sizeof(short);
                ulong gid = this.objectIdContainer[objIdIndexes[i]];
                this.delObjId = gid;
                byte[] longTermId = this.GetLongTermIdByte(serverId, gid);
                Array.Copy(longTermId, 0, deleteGidValue, index, longTermId.Length);
                propertyValue.Value = deleteGidValue;
                propertyValues[i] = propertyValue;
            }

            synchronizationImportDeletesRequest.PropertyValues = propertyValues;

            // Send the RopSynchronizationImportDeletes request to get the success response.
            synchronizationImportDeletesResponse = (RopSynchronizationImportDeletesResponse)this.Process(serverId, synchronizationImportDeletesRequest, synchronizationImportDeletesHandle);
            result = (RopResult)synchronizationImportDeletesResponse.ReturnValue;

            if (result == RopResult.Success)
            {
                this.isNonImportMessageChangeOperation = true;
                this.hasExecuteSynchronizationImportDeletes = true;
            }

            // Verify ROP SynchronizationImportDeletes
            this.VerifyRopSynchronizationImportDeletes(synchronizationImportDeletesRequest, synchronizationImportDeletesResponse);

            return result;
        }