public static RuleActionMoveCopyData ConvertToDownlevel(RuleActionMoveCopyData uplevelRA)
        {
            RuleActionInMailboxMoveCopyData ruleActionInMailboxMoveCopyData = uplevelRA as RuleActionInMailboxMoveCopyData;

            if (ruleActionInMailboxMoveCopyData != null)
            {
                RuleActionInMailboxMoveData ruleActionInMailboxMoveData = ruleActionInMailboxMoveCopyData as RuleActionInMailboxMoveData;
                if (ruleActionInMailboxMoveData != null)
                {
                    return(new RuleActionMoveData
                    {
                        FolderEntryID = ruleActionInMailboxMoveData.FolderEntryID,
                        StoreEntryID = RuleAction.MoveCopy.InThisStoreBytes
                    });
                }
                RuleActionInMailboxCopyData ruleActionInMailboxCopyData = ruleActionInMailboxMoveCopyData as RuleActionInMailboxCopyData;
                return(new RuleActionCopyData
                {
                    FolderEntryID = ruleActionInMailboxCopyData.FolderEntryID,
                    StoreEntryID = RuleAction.MoveCopy.InThisStoreBytes
                });
            }
            else
            {
                RuleActionExternalMoveCopyData ruleActionExternalMoveCopyData = uplevelRA as RuleActionExternalMoveCopyData;
                RuleActionExternalMoveData     ruleActionExternalMoveData     = ruleActionExternalMoveCopyData as RuleActionExternalMoveData;
                if (ruleActionExternalMoveData != null)
                {
                    return(new RuleActionMoveData
                    {
                        FolderEntryID = ruleActionExternalMoveData.FolderEntryID,
                        StoreEntryID = ruleActionExternalMoveData.StoreEntryID
                    });
                }
                RuleActionExternalCopyData ruleActionExternalCopyData = ruleActionExternalMoveCopyData as RuleActionExternalCopyData;
                return(new RuleActionCopyData
                {
                    FolderEntryID = ruleActionExternalCopyData.FolderEntryID,
                    StoreEntryID = ruleActionExternalCopyData.StoreEntryID
                });
            }
        }
示例#2
0
        public static RuleActionData GetRuleActionData(RuleAction ruleAction)
        {
            RuleActionData ruleActionData;

            if (ruleAction is RuleAction.InMailboxMove)
            {
                ruleActionData = new RuleActionInMailboxMoveData((RuleAction.InMailboxMove)ruleAction);
            }
            else if (ruleAction is RuleAction.InMailboxCopy)
            {
                ruleActionData = new RuleActionInMailboxCopyData((RuleAction.InMailboxCopy)ruleAction);
            }
            else if (ruleAction is RuleAction.ExternalMove)
            {
                ruleActionData = new RuleActionExternalMoveData((RuleAction.ExternalMove)ruleAction);
            }
            else if (ruleAction is RuleAction.ExternalCopy)
            {
                ruleActionData = new RuleActionExternalCopyData((RuleAction.ExternalCopy)ruleAction);
            }
            else if (ruleAction is RuleAction.Reply)
            {
                ruleActionData = new RuleActionReplyData((RuleAction.Reply)ruleAction);
            }
            else if (ruleAction is RuleAction.OOFReply)
            {
                ruleActionData = new RuleActionOOFReplyData((RuleAction.OOFReply)ruleAction);
            }
            else if (ruleAction is RuleAction.Forward)
            {
                ruleActionData = new RuleActionForwardData((RuleAction.Forward)ruleAction);
            }
            else if (ruleAction is RuleAction.Delegate)
            {
                ruleActionData = new RuleActionDelegateData((RuleAction.Delegate)ruleAction);
            }
            else if (ruleAction is RuleAction.Bounce)
            {
                ruleActionData = new RuleActionBounceData((RuleAction.Bounce)ruleAction);
            }
            else if (ruleAction is RuleAction.Tag)
            {
                ruleActionData = new RuleActionTagData((RuleAction.Tag)ruleAction);
            }
            else if (ruleAction is RuleAction.Defer)
            {
                ruleActionData = new RuleActionDeferData((RuleAction.Defer)ruleAction);
            }
            else if (ruleAction is RuleAction.Delete)
            {
                ruleActionData = new RuleActionDeleteData((RuleAction.Delete)ruleAction);
            }
            else
            {
                if (!(ruleAction is RuleAction.MarkAsRead))
                {
                    return(null);
                }
                ruleActionData = new RuleActionMarkAsReadData((RuleAction.MarkAsRead)ruleAction);
            }
            ruleActionData.UserFlags = ruleAction.UserFlags;
            return(ruleActionData);
        }