/// <summary> /// Initializes a FastTransfer operation to download content from a given messaging object and its descendant subobjects. /// </summary> /// <param name="serverId">A 32-bit signed integer represent the Identity of server.</param> /// <param name="sourceHandleIndex">Folder or message object handle index. </param> /// <param name="handleType">Type of object handle. </param> /// <param name="level">Variable indicate whether copy the descendant subobjects.</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="propertyTags">The list of properties and subobjects to exclude.</param> /// <param name="copyPropertiesHandleIndex">The properties handle index.</param> /// <returns>Indicate the result of this ROP operation.</returns> public RopResult FastTransferSourceCopyProperties(int serverId, int sourceHandleIndex, InputHandleType handleType, bool level, CopyPropertiesCopyFlags copyFlag, SendOptionAlls option, Sequence<string> propertyTags, out int copyPropertiesHandleIndex) { // Initialize ROP data. RopResult result = RopResult.InvalidParameter; RopFastTransferSourceCopyPropertiesRequest req; copyPropertiesHandleIndex = -1; uint sourceHandle = this.handleContainer[sourceHandleIndex]; // Get stream type. switch (handleType) { case InputHandleType.FolderHandle: this.streamType = FastTransferStreamType.folderContent; break; case InputHandleType.MessageHandle: this.streamType = FastTransferStreamType.MessageContent; break; case InputHandleType.AttachmentHandle: this.streamType = FastTransferStreamType.attachmentContent; break; default: break; } // Initialize input propertyTags. ushort propertyCount = (ushort)propertyTags.Count; PropertyTag[] messageSamplePropertyTags = new PropertyTag[propertyCount]; for (int i = 0; i < propertyCount; i++) { messageSamplePropertyTags[i] = this.propertyTagsDictionary[propertyTags[i]]; } this.previousOperation = EnumFastTransferOperation.FastTransferSourceCopyProperties; this.propertyTags = messageSamplePropertyTags; this.copySubObjects = !level; // Construct ROP request. req.RopId = 0x69; req.LogonId = 0x00; req.InputHandleIndex = 0x00; req.OutputHandleIndex = 0x01; // This value specifies the level at which the copy is occurring, which is specified in [MS-OXCROPS]. req.Level = (byte)(level ? 1 : 0); req.CopyFlags = (byte)copyFlag; req.SendOptions = (byte)option; req.PropertyTagCount = propertyCount; req.PropertyTags = messageSamplePropertyTags; // Send request and get response. RopFastTransferSourceCopyPropertiesResponse response = (RopFastTransferSourceCopyPropertiesResponse)this.Process(serverId, req, sourceHandle); result = (RopResult)response.ReturnValue; if (result == RopResult.Success) { copyPropertiesHandleIndex = AdapterHelper.GetHandleIndex(); this.handleContainer.Add(copyPropertiesHandleIndex, this.responseSOHs[response.OutputHandleIndex]); } // Verify ROP FastTransferSourceCopyProperties this.VerifyRopFastTransferSourceCopyProperties(req, response); return result; }
public static RopResult FastTransferSourceCopyProperties(int serverId, int objHandleIndex, InputHandleType handleType, bool level, CopyPropertiesCopyFlags copyFlag, SendOptionAlls option, Sequence<string> propertyTags, 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; // SendOptionAll value is Invalid parameter if ((option == SendOptionAlls.Invalid && (requirementContainer.ContainsKey(3470) && requirementContainer[3470])) || (copyFlag == CopyPropertiesCopyFlags.Invalid && (requirementContainer.ContainsKey(3466) && requirementContainer[3466]))) { downloadContextHandleIndex = -1; } else if (((copyFlag & CopyPropertiesCopyFlags.Move) == CopyPropertiesCopyFlags.Move) && (requirementContainer.ContainsKey(3466) && requirementContainer[3466])) { // CopyPropertiesCopyFlags value is Move. result = RopResult.NotImplemented; downloadContextHandleIndex = -1; } else { // Create a new download context. AbstractDownloadInfo downloadInfo = new AbstractDownloadInfo(); ConnectionData changeConnection = connections[serverId]; bool isObjExist = false; connections.Remove(serverId); if (handleType == InputHandleType.MessageHandle) { foreach (AbstractMessage temp in changeConnection.MessageContainer) { if (temp.MessageHandleIndex == objHandleIndex) { isObjExist = true; } } Condition.IsTrue(isObjExist); // Set value for new download context. downloadContextHandleIndex = AdapterHelper.GetHandleIndex(); downloadInfo.DownloadHandleIndex = downloadContextHandleIndex; downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.MessageContent; // Record the FastTransferOperation downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyProperties; priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyProperties; // Set value for new download context. downloadInfo.CopyPropertiesCopyFlag = copyFlag; downloadInfo.Property = propertyTags; downloadInfo.Sendoptions = option; downloadInfo.RelatedObjectHandleIndex = objHandleIndex; downloadInfo.ObjectType = ObjectType.Message; downloadInfo.IsLevelTrue = level; // Add new download context to DownloadContextContainer. changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(downloadInfo); } else if (handleType == InputHandleType.FolderHandle) { // Find current folder. foreach (AbstractFolder temp in changeConnection.FolderContainer) { if (temp.FolderHandleIndex == objHandleIndex) { isObjExist = true; } } Condition.IsTrue(isObjExist); // Set value for new download context. downloadContextHandleIndex = AdapterHelper.GetHandleIndex(); downloadInfo.DownloadHandleIndex = downloadContextHandleIndex; downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.folderContent; // Record the FastTransferOperation downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyProperties; priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyProperties; // Set value for new download context. downloadInfo.CopyPropertiesCopyFlag = copyFlag; downloadInfo.Property = propertyTags; downloadInfo.Sendoptions = option; downloadInfo.RelatedObjectHandleIndex = objHandleIndex; downloadInfo.ObjectType = ObjectType.Folder; // Add new download context to DownloadContextContainer. changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(downloadInfo); } else { // Find the current Attachment foreach (AbstractAttachment temp in changeConnection.AttachmentContainer) { if (temp.AttachmentHandleIndex == objHandleIndex) { isObjExist = true; } } Condition.IsTrue(isObjExist); // Set value for new download context. downloadContextHandleIndex = AdapterHelper.GetHandleIndex(); downloadInfo.DownloadHandleIndex = downloadContextHandleIndex; downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.attachmentContent; // Record the FastTransferOperation downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyProperties; priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyProperties; // Set value for new download context. downloadInfo.CopyPropertiesCopyFlag = copyFlag; downloadInfo.Property = propertyTags; downloadInfo.Sendoptions = option; downloadInfo.ObjectType = ObjectType.Attachment; downloadInfo.RelatedObjectHandleIndex = objHandleIndex; // Add new download context to DownloadContextContainer. changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(downloadInfo); } connections.Add(serverId, changeConnection); result = RopResult.Success; // If the server returns success result, it means the RopFastTransferSourceCopyProperties ROP initializes the FastTransfer operation successfully. And then this requirement can be captured. ModelHelper.CaptureRequirement( 431, @"[In RopFastTransferSourceCopyProperties ROP] The RopFastTransferSourceCopyProperties ROP ([MS-OXCROPS] section 2.2.12.7) initializes a FastTransfer operation to download content from a specified messaging object and its descendant sub objects."); } return result; }