/// <summary> /// Initializes a FastTransfer operation on a folder for downloading content and descendant subobjects for messages identified by a given set of IDs. /// </summary> /// <param name="serverId">A 32-bit signed integer represent the Identity of server.</param> /// <param name="sourceHandleIndex">Folder object handle index. </param> /// <param name="copyFlag">Defines parameters of the FastTransfer download operation.</param> /// <param name="option">Defines the parameters of a download operation.</param> /// <param name="messageIds">The list of MIDs the messages should copy.</param> /// <param name="copyMessageHandleIndex">The message handle index.</param> /// <returns>Indicate the result of this ROP operation.</returns> public RopResult FastTransferSourceCopyMessages(int serverId, int sourceHandleIndex, RopFastTransferSourceCopyMessagesCopyFlags copyFlag, SendOptionAlls option, Sequence<int> messageIds, out int copyMessageHandleIndex) { // Initialize ROP data RopResult result = RopResult.InvalidParameter; copyMessageHandleIndex = -1; this.streamType = FastTransferStreamType.MessageList; RopFastTransferSourceCopyMessagesRequest req; uint sourceHandle = this.handleContainer[sourceHandleIndex]; ushort idcount = (ushort)messageIds.Count; ulong[] messageId = new ulong[idcount]; int index = 0; foreach (int mID in messageIds) { messageId[index++] = this.objectIdContainer[mID]; } // Construct ROP request. req.RopId = 0x4B; req.LogonId = 0x00; req.InputHandleIndex = 0x00; req.OutputHandleIndex = 0x01; req.MessageIdCount = idcount; req.MessageIds = messageId; req.CopyFlags = (byte)copyFlag; req.SendOptions = (byte)option; // Stores message id and copy flag this.previousOperation = EnumFastTransferOperation.FastTransferSourceCopyMessage; this.messageIdForFastTransferSourceCopyMessages = (long)messageId[0]; this.copyFlagForFastTransferSourceCopyMessages = copyFlag; // Send request and get response. RopFastTransferSourceCopyMessagesResponse response = (RopFastTransferSourceCopyMessagesResponse)this.Process(serverId, req, sourceHandle); result = (RopResult)response.ReturnValue; if (result == RopResult.Success) { copyMessageHandleIndex = AdapterHelper.GetHandleIndex(); this.handleContainer.Add(copyMessageHandleIndex, this.responseSOHs[response.OutputHandleIndex]); } // Verify ROP FastTransferSourceCopyMessages this.VerifyRopFastTransferSourceCopyMessages(req, response); return result; }
public static RopResult FastTransferSourceCopyMessages(int serverId, int objHandleIndex, RopFastTransferSourceCopyMessagesCopyFlags copyFlag, SendOptionAlls option, Sequence<int> messageIds, out int downloadContextHandleIndex) { // The contraction conditions Condition.IsTrue(connections.Count > 0); Condition.IsTrue(connections.Keys.Contains(serverId)); // Initialize the return value. RopResult result = RopResult.InvalidParameter; if (option == SendOptionAlls.Invalid) { if (requirementContainer.ContainsKey(3479) && requirementContainer[3479]) { // SendOption flags value is invalid downloadContextHandleIndex = -1; return result; } } // Modify the logical if ((copyFlag & RopFastTransferSourceCopyMessagesCopyFlags.Unused3) == RopFastTransferSourceCopyMessagesCopyFlags.Unused3) { // CopyFlags is set to Unused3 downloadContextHandleIndex = -1; } else { // Identify whether the current folder is existent or not. ConnectionData changeConnection = connections[serverId]; bool isFolderExist = false; foreach (AbstractFolder tempFolder in changeConnection.FolderContainer) { if (tempFolder.FolderHandleIndex == objHandleIndex) { isFolderExist = true; } } Condition.IsTrue(isFolderExist); // Set value for new download context. AbstractDownloadInfo downloadInfo = new AbstractDownloadInfo(); downloadContextHandleIndex = AdapterHelper.GetHandleIndex(); downloadInfo.DownloadHandleIndex = downloadContextHandleIndex; connections.Remove(serverId); downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.MessageList; downloadInfo.CopyMessageCopyFlag = copyFlag; // Record the FastTransferOperation downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyMessage; priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyMessage; // Set value for new download context. downloadInfo.Sendoptions = option; downloadInfo.RelatedObjectHandleIndex = objHandleIndex; downloadInfo.ObjectType = ObjectType.Folder; // Add new download context to DownloadContextContainer. changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(downloadInfo); connections.Add(serverId, changeConnection); priorOperation = MS_OXCFXICS.PriorOperation.RopFastTransferSourceCopyMessage; result = RopResult.Success; // If the server returns success result, it means the RopFastTransferSourceCopyMessages ROP initializes the FastTransfer operation successfully. And then this requirement can be captured. ModelHelper.CaptureRequirement( 3125, @"[In RopFastTransferSourceCopyMessages ROP] The RopFastTransferSourceCopyMessages ROP ([MS-OXCROPS] section 2.2.12.5) initializes a FastTransfer operation on a folder for downloading content and descendant subobjects of messages identified by a set of MID structures ([MS-OXCDATA] section 2.2.1.2)."); } return result; }