コード例 #1
0
        public static RopResult SynchronizationConfigure(int serverId, int folderHandleIndex, SynchronizationTypes synchronizationType, SendOptionAlls option, SynchronizationFlag synchronizationFlag, SynchronizationExtraFlag synchronizationExtraFlag, Sequence<string> property, out int downloadcontextHandleIndex)
        {
            // The contractions conditions.
            Condition.IsTrue(connections.Count > 0);
            Condition.IsTrue(connections.Keys.Contains(serverId));
            Condition.IsTrue(connections[serverId].FolderContainer.Count > 0);

            // Initialize return value.
            RopResult result = RopResult.Success;
            downloadcontextHandleIndex = -1;

            if ((option & SendOptionAlls.Invalid) == SendOptionAlls.Invalid && (requirementContainer.ContainsKey(3463) && requirementContainer[3463]))
            {
                result = RopResult.InvalidParameter;
                return result;
            }

            // SynchronizationFlag MUST match the value of the Unicode flag from SendOptions field.
            if ((synchronizationFlag & SynchronizationFlag.Unicode) == SynchronizationFlag.Unicode)
            {
                Condition.IsTrue((option & SendOptionAlls.Unicode) == SendOptionAlls.Unicode);
            }

            // When SynchronizationType is 0X04 then Servers return 0x80070057.
            if (synchronizationType == SynchronizationTypes.InvalidParameter)
            {
                if (requirementContainer.ContainsKey(2695) && requirementContainer[2695])
                {
                    result = RopResult.NotSupported;
                }
                else
                {
                    result = RopResult.InvalidParameter;
                    ModelHelper.CaptureRequirement(2695, "[In Receiving a RopSynchronizationConfigure ROP Request] [SynchronizationType Constraints] Servers MUST return 0x80070057 if SynchronizationType is 0x04.");
                }
            }
            else if ((synchronizationFlag & SynchronizationFlag.Reserved) == SynchronizationFlag.Reserved)
            {
                // When SynchronizationType is Reserved then Servers MUST fail the ROP request.
                result = RopResult.RpcFormat;
                ModelHelper.CaptureRequirement(2180, "[In Receiving a RopSynchronizationConfigure ROP Request] [SynchronizationType Constraints] The server MUST fail the ROP request if the Reserved flag of the SynchronizationFlags field is set.");
            }
            else
            {
                // Get ConnectionData value.
                ConnectionData changeConnection = connections[serverId];

                // Identify whether the CurrentFolder is existent or not.
                bool isCurrentFolderExist = false;

                // Identify whether the Current Folder is existent or not.
                foreach (AbstractFolder tempfolder in changeConnection.FolderContainer)
                {
                    if (tempfolder.FolderHandleIndex == folderHandleIndex)
                    {
                        // Set the value to the variable when the current folder is existent.
                        isCurrentFolderExist = true;
                    }
                }

                // The condition of CurrentFolder is existent.
                if (isCurrentFolderExist)
                {
                    // Initialize the Download information.
                    AbstractDownloadInfo abstractDownloadInfo = new AbstractDownloadInfo
                    {
                        UpdatedState =
                            new AbstractUpdatedState
                            {
                                CnsetRead = new Set<int>(),
                                CnsetSeen = new Set<int>(),
                                CnsetSeenFAI = new Set<int>(),
                                IdsetGiven = new Set<int>()
                            },
                        DownloadHandleIndex = AdapterHelper.GetHandleIndex()
                    };

                    // Get the download Handle for download context.
                    downloadcontextHandleIndex = abstractDownloadInfo.DownloadHandleIndex;
                    ModelHelper.CaptureRequirement(669, "[In RopSynchronizationConfigure ROP Response Buffer]OutputServerObject: This value MUST be the synchronization download context.");

                    // Record the flags.
                    abstractDownloadInfo.Sendoptions = option;
                    abstractDownloadInfo.SynchronizationType = synchronizationType;
                    abstractDownloadInfo.Synchronizationflag = synchronizationFlag;
                    abstractDownloadInfo.SynchronizationExtraflag = synchronizationExtraFlag;

                    // Record the Property.
                    abstractDownloadInfo.Property = property;

                    // Record folder handle of related to the download context. 
                    abstractDownloadInfo.RelatedObjectHandleIndex = folderHandleIndex;
                    switch (synchronizationType)
                    {
                        // Record synchronizationType value for condition of Synchronization type is Contents.
                        case SynchronizationTypes.Contents:
                            abstractDownloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.contentsSync;
                            abstractDownloadInfo.ObjectType = ObjectType.Folder;
                            break;

                        // Record synchronizationType value for condition of Synchronization type is Hierarchy.
                        case SynchronizationTypes.Hierarchy:
                            abstractDownloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.hierarchySync;
                            abstractDownloadInfo.ObjectType = ObjectType.Folder;
                            break;
                        default:

                            // Condition ofsynchronizationType is invalid parameter.
                            result = RopResult.InvalidParameter;
                            break;
                    }

                    // Condition of the operation return success.
                    if (result == RopResult.Success)
                    {
                        // Add the  new value to DownloadContextContainer.
                        changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(abstractDownloadInfo);
                        connections[serverId] = changeConnection;
                        priorDownloadOperation = PriorDownloadOperation.RopSynchronizationConfigure;
                        priorOperation = MS_OXCFXICS.PriorOperation.RopSynchronizationConfigure;

                        ModelHelper.CaptureRequirement(
                            641,
                            @"[In RopSynchronizationConfigure] The RopSynchronizationConfigure ROP ([MS-OXCROPS] section 2.2.13.1) is used to define the synchronization scope and parameters of the synchronization download operation.");
                    }
                }
            }

            return result;
        }
コード例 #2
0
        public static RopResult FastTransferSourceCopyFolder(int serverId, int folderHandleIndex, CopyFolderCopyFlags copyFlag, SendOptionAlls option, 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;

            // Modify the logical
            if ((option == SendOptionAlls.Invalid && (requirementContainer.ContainsKey(3487) && requirementContainer[3487])) ||
                (copyFlag == CopyFolderCopyFlags.Invalid && (requirementContainer.ContainsKey(3483) && requirementContainer[3483])))
            {
                // SendOption is Invalid parameter and CopyFolderCopyFlags is Invalid parameter.
                downloadContextHandleIndex = -1;
                return result;
            }
            else if (copyFlag == CopyFolderCopyFlags.Move && (requirementContainer.ContainsKey(526001) && !requirementContainer[526001]))
            {
                downloadContextHandleIndex = -1;
                ModelHelper.CaptureRequirement(
                            526001,
                            @"[In Appendix A: Product Behavior] [CopyFlags] [When the flag name is Move, value is 0x01] Implementation does set the Move flag on a download operation to indicate the following: The server does not output any objects in a FastTransfer stream that the client does not have permissions to delete. <7> Section 2.2.3.1.1.4.1: In Exchange 2007, the Move bit flag is read by the server.");

                return result;
            }
            else
            {
                ConnectionData changeConnection = connections[serverId];

                // Identify whether the current folder is existent or not.
                bool isFolderExist = false;
                foreach (AbstractFolder tempFolder in changeConnection.FolderContainer)
                {
                    if (tempFolder.FolderHandleIndex == folderHandleIndex)
                    {
                        isFolderExist = true;
                    }
                }

                Condition.IsTrue(isFolderExist);

                // Create a new download context.
                AbstractDownloadInfo downloadInfo = new AbstractDownloadInfo();
                downloadContextHandleIndex = AdapterHelper.GetHandleIndex();
                downloadInfo.DownloadHandleIndex = downloadContextHandleIndex;
                connections.Remove(serverId);

                // Record the FastTransferOperation and Stream Type.
                downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.TopFolder;
                downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyFolder;
                priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyFolder;

                // Set value for new download context.
                downloadInfo.CopyFolderCopyFlag = copyFlag;
                downloadInfo.Sendoptions = option;
                downloadInfo.ObjectType = ObjectType.Folder;
                downloadInfo.RelatedObjectHandleIndex = folderHandleIndex;

                // Add new download context to downloadContainer.
                changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(downloadInfo);
                connections.Add(serverId, changeConnection);

                result = RopResult.Success;

                // If the server returns success result, it means the RopFastTransferSourceCopyFolder ROP initializes the FastTransfer operation successfully. And then this requirement can be captured.
                ModelHelper.CaptureRequirement(
                            502,
                            @"[In RopFastTransferSourceCopyFolder ROP] The RopFastTransferSourceCopyFolder ROP ([MS-OXCROPS] section 2.2.12.4) initializes a FastTransfer operation to download properties and descendant subobjects for a specified folder.");
            }

            return result;
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        public static RopResult FastTransferSourceCopyTo(int serverId, int objHandleIndex, InputHandleType handleType, bool level, CopyToCopyFlags 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;

            // The copyFlag conditions.
            if (((copyFlag == CopyToCopyFlags.Invalid && (requirementContainer.ContainsKey(3445) && requirementContainer[3445])) || (option == SendOptionAlls.Invalid && (requirementContainer.ContainsKey(3463) && requirementContainer[3463]))) ||
                ((copyFlag & CopyToCopyFlags.Move) == CopyToCopyFlags.Move && (requirementContainer.ContainsKey(3442001) && requirementContainer[3442001])) ||
                ((copyFlag & CopyToCopyFlags.Move) == CopyToCopyFlags.Move && (requirementContainer.ContainsKey(3442003) && requirementContainer[3442003])))
            {
                downloadContextHandleIndex = -1;
                if ((copyFlag & CopyToCopyFlags.Move) == CopyToCopyFlags.Move)
                {
                    // CopyToCopyFlags value is Move.
                    if (requirementContainer.ContainsKey(3442001) && requirementContainer[3442001])
                    {
                        // When the ROP return invalid parameter this requirement verified.
                        ModelHelper.CaptureRequirement(
                        3442001,
                        @"[In Appendix A: Product Behavior] Implementation does not support. <31> Section 3.2.5.8.1.1: Exchange 2010 and Exchange 2013 do not support the Move flag for the RopFastTransferSourceCopyTo ROP (section 2.2.3.1.1.1).");
                    }

                    if (requirementContainer.ContainsKey(3442003) && requirementContainer[3442003])
                    {
                        result = RopResult.InvalidParameter;

                        // When the ROP return invalid parameter this requirement verified.
                        ModelHelper.CaptureRequirement(
                        3442003,
                        @"[In Appendix A: Product Behavior] If the server receives the Move flag, implementation does fail the operation with an error code InvalidParameter (0x80070057).  <31> Section 3.2.5.8.1.1: The server sets the value of the ReturnValue field to InvalidParameter (0x80070057) if it receives this flag [Move flag].(Microsoft Exchange Server 2010, Exchange Server 2013 and  Exchange Server 2016 follow this behavior.)");
                    }
                }

                return result;
            }
            else
            {
                // Create a new download context
                AbstractDownloadInfo downloadInfo = new AbstractDownloadInfo();
                bool isObjExist = false;

                // Get value of ConnectionData
                ConnectionData changeConnection = connections[serverId];
                connections.Remove(serverId);

                // Find current message
                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.
                    downloadInfo.DownloadHandleIndex = AdapterHelper.GetHandleIndex();
                    downloadContextHandleIndex = downloadInfo.DownloadHandleIndex;
                    downloadInfo.Sendoptions = option;
                    downloadInfo.Property = propertyTags;
                    downloadInfo.CopyToCopyFlag = copyFlag;
                    downloadInfo.IsLevelTrue = level;

                    // Record FastTransfer Operation.
                    downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyTo;
                    downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.MessageContent;
                    downloadInfo.ObjectType = ObjectType.Message;
                    downloadInfo.RelatedObjectHandleIndex = objHandleIndex;

                    priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyTo;

                    // Add new download context to downloadContext Container.
                    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.
                    downloadInfo.DownloadHandleIndex = AdapterHelper.GetHandleIndex();
                    downloadContextHandleIndex = downloadInfo.DownloadHandleIndex;
                    downloadInfo.Sendoptions = option;
                    downloadInfo.Property = propertyTags;
                    downloadInfo.CopyToCopyFlag = copyFlag;

                    // Record FastTransfer Operation
                    downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyTo;
                    downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.folderContent;
                    downloadInfo.ObjectType = ObjectType.Folder;
                    downloadInfo.RelatedObjectHandleIndex = objHandleIndex;

                    priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyTo;

                    // Add new download context to DownloadContextContainer
                    changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(downloadInfo);
                }
                else
                {
                    // Find current attachment
                    foreach (AbstractAttachment temp in changeConnection.AttachmentContainer)
                    {
                        if (temp.AttachmentHandleIndex == objHandleIndex)
                        {
                            isObjExist = true;
                        }
                    }

                    Condition.IsTrue(isObjExist);

                    // Set value for new download context.
                    downloadInfo.DownloadHandleIndex = AdapterHelper.GetHandleIndex();
                    downloadContextHandleIndex = downloadInfo.DownloadHandleIndex;
                    downloadInfo.Sendoptions = option;
                    downloadInfo.Property = propertyTags;
                    downloadInfo.CopyToCopyFlag = copyFlag;

                    // Record FastTransfer Operation
                    downloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.FastTransferSourceCopyTo;
                    downloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.attachmentContent;
                    downloadInfo.ObjectType = ObjectType.Attachment;
                    downloadInfo.RelatedObjectHandleIndex = objHandleIndex;

                    priorDownloadOperation = PriorDownloadOperation.RopFastTransferSourceCopyTo;

                    // Add new download context to DownloadContextContainer
                    changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(downloadInfo);
                }

                connections.Add(serverId, changeConnection);

                result = RopResult.Success;
                ModelHelper.CaptureRequirement(
                    361,
                    @"[In RopFastTransferSourceCopyTo ROP] The RopFastTransferSourceCopyTo ROP ([MS-OXCROPS] section 2.2.12.6) initializes a FastTransfer operation to download content from a given messaging object and its descendant subobjects.");

                if ((copyFlag & CopyToCopyFlags.Move) == CopyToCopyFlags.Move)
                {
                    if (requirementContainer.ContainsKey(3442002) && requirementContainer[3442002])
                    {
                        ModelHelper.CaptureRequirement(
                            3442002,
                            @"[In Appendix A: Product Behavior] Implementation does support Move flag [for the RopFastTransferSourceCopyTo ROP]. (Microsoft Exchange Server 2007 follow this behavior.)");
                    }

                    if (requirementContainer.ContainsKey(3442004) && requirementContainer[3442004])
                    {
                        ModelHelper.CaptureRequirement(
                            3442004,
                            @"[In Appendix A: Product Behavior] If the server receives the Move flag, implementation does not fail the operation.(<31> Section 3.2.5.8.1.1: Microsoft Exchange Server 2007 follows this behavior.)");
                    }
                }
            }

            return result;
        }
コード例 #6
0
        public static RopResult SynchronizationGetTransferState(int serverId, int syncHandleIndex, out int downloadcontextHandleIndex)
        {
            // The contractions conditions.
            Condition.IsTrue(connections.Count > 0);
            Condition.IsTrue(connections.Keys.Contains(serverId));
            Condition.IsTrue(connections[serverId].UploadContextContainer.Count > 0 || connections[serverId].DownloadContextContainer.Count > 0);

            // Initialize the return value.
            RopResult result = RopResult.InvalidParameter;
            downloadcontextHandleIndex = -1;

            // Get the current ConnectionData value.
            ConnectionData changeConnection = connections[serverId];
            AbstractDownloadInfo downloadInfo = new AbstractDownloadInfo();
            AbstractUploadInfo uploadInfo = new AbstractUploadInfo();

            // Identify whether the Download context or Upload context is existent or not and record the index.
            bool isCurrentDownloadInfoExist = false;
            bool isCurrentUploadInfoExist = false;

            foreach (AbstractDownloadInfo temp in changeConnection.DownloadContextContainer)
            {
                if (temp.DownloadHandleIndex == syncHandleIndex)
                {
                    // Set the value to the related variable when the current Download context is existent.
                    isCurrentDownloadInfoExist = true;
                    downloadInfo = temp;
                }
            }

            if (!isCurrentDownloadInfoExist)
            {
                foreach (AbstractUploadInfo tempInfo in changeConnection.UploadContextContainer)
                {
                    if (tempInfo.UploadHandleIndex == syncHandleIndex)
                    {
                        // Set the value to the related variable when the current upload context is existent.
                        isCurrentUploadInfoExist = true;
                        uploadInfo = tempInfo;
                    }
                }
            }

            if (isCurrentDownloadInfoExist || isCurrentUploadInfoExist)
            {
                // Create a new download context.
                AbstractDownloadInfo newDownloadInfo = new AbstractDownloadInfo
                {
                    DownloadHandleIndex = AdapterHelper.GetHandleIndex()
                };

                // Out the new downloadHandle.
                downloadcontextHandleIndex = newDownloadInfo.DownloadHandleIndex;
                ModelHelper.CaptureRequirement(765, "[In RopSynchronizationGetTransferState ROP Response Buffer]OutputServerObject: The value of this field MUST be the FastTransfer download context for the ICS state.");
                if (isCurrentDownloadInfoExist)
                {
                    // Set the new Download context value
                    newDownloadInfo.RelatedObjectHandleIndex = downloadInfo.RelatedObjectHandleIndex;
                    newDownloadInfo.SynchronizationType = downloadInfo.SynchronizationType;
                    newDownloadInfo.UpdatedState = downloadInfo.UpdatedState;
                    priorDownloadOperation = PriorDownloadOperation.RopSynchronizationGetTransferState;
                }
                else
                {
                    // Set the new Upload context value
                    newDownloadInfo.RelatedObjectHandleIndex = uploadInfo.RelatedObjectHandleIndex;
                    newDownloadInfo.SynchronizationType = uploadInfo.SynchronizationType;
                    newDownloadInfo.UpdatedState = uploadInfo.UpdatedState;
                }

                // Set the abstractFastTransferStreamType for new  Down loadContext value
                newDownloadInfo.AbstractFastTransferStreamType = FastTransferStreamType.state;
                newDownloadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.SynchronizationGetTransferState;

                // Add new download context to DownloadContextContainer.
                changeConnection.DownloadContextContainer = changeConnection.DownloadContextContainer.Add(newDownloadInfo);
                connections[serverId] = changeConnection;
                result = RopResult.Success;

                // Because context created if the RopSynchronizationGetTransferState execute successful.
                ModelHelper.CaptureRequirement(
                    758,
                    @"[In RopSynchronizationGetTransferState ROP] The RopSynchronizationGetTransferState ROP ([MS-OXCROPS] section 2.2.13.8) creates a FastTransfer download context for the checkpoint ICS state of the operation identified by the given synchronization download context or synchronization upload context at the current moment in time.");
            }

            return result;
        }