コード例 #1
0
        /// <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;
        }
コード例 #2
0
        /// <summary>
        /// Verify RopSynchronizationImportDeletes Response
        /// </summary>
        /// <param name="ropSynchronizationImportDeletesResponse">The response of RopSynchronizationImportDeletes request</param>
        /// <param name="inputHandleIndex">The field of InputHandleIndex in RopSynchronizationImportDeletes request</param>
        private void VerifyRopSynchronizationImportDeletesResponse(RopSynchronizationImportDeletesResponse ropSynchronizationImportDeletesResponse, byte inputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4083");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4083
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropSynchronizationImportDeletesResponse.RopId.GetType(),
                4083,
                @"[In RopSynchronizationImportDeletes ROP Response Buffer] RopId (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4085
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopSynchronizationImportDeletes,
                ropSynchronizationImportDeletesResponse.RopId,
                4085,
                @"[In RopSynchronizationImportDeletes ROP Response Buffer, RopId (1 byte):] For this operation[RopSynchronizationImportDeletes] this field is set to 0x74.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4086
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropSynchronizationImportDeletesResponse.InputHandleIndex.GetType(),
                4086,
                @"[In RopSynchronizationImportDeletes ROP Response Buffer]InputHandleIndex (1 byte): An unsigned  integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4087
            Site.CaptureRequirementIfAreEqual<byte>(
                inputHandleIndex,
                ropSynchronizationImportDeletesResponse.InputHandleIndex,
                4087,
                @"[In RopSynchronizationImportDeletes ROP Response Buffer, InputHandleIndex (1 byte):] This index MUST be set to the value specified in the InputHandleIndex field in the request.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4089
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropSynchronizationImportDeletesResponse.ReturnValue.GetType(),
                4089,
                @"[In RopSynchronizationImportDeletes ROP Response Buffer] ReturnValue (4 bytes): An unsigned integer.");
        }