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
                });
            }
        }
Exemplo n.º 2
0
 public static void ConvertRulesToDownlevel(RuleData[] rules)
 {
     if (rules != null)
     {
         foreach (RuleData ruleData in rules)
         {
             if (ruleData.Actions != null)
             {
                 for (int j = 0; j < ruleData.Actions.Length; j++)
                 {
                     RuleActionMoveCopyData ruleActionMoveCopyData = ruleData.Actions[j] as RuleActionMoveCopyData;
                     if (ruleActionMoveCopyData != null)
                     {
                         ruleData.Actions[j] = RuleActionMoveCopyData.ConvertToDownlevel(ruleActionMoveCopyData);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public static void ConvertRulesToUplevel(RuleData[] rules, Func <byte[], bool> isFolderLocal)
 {
     if (rules != null)
     {
         foreach (RuleData ruleData in rules)
         {
             if (ruleData.Actions != null)
             {
                 for (int j = 0; j < ruleData.Actions.Length; j++)
                 {
                     RuleActionMoveCopyData ruleActionMoveCopyData = ruleData.Actions[j] as RuleActionMoveCopyData;
                     if (ruleActionMoveCopyData != null)
                     {
                         bool folderIsLocal = isFolderLocal(ruleActionMoveCopyData.FolderEntryID);
                         ruleData.Actions[j] = RuleActionMoveCopyData.ConvertToUplevel(ruleActionMoveCopyData, folderIsLocal);
                     }
                 }
             }
         }
     }
 }
        public static RuleActionMoveCopyData ConvertToUplevel(RuleActionMoveCopyData downlevelRA, bool folderIsLocal)
        {
            RuleActionMoveData ruleActionMoveData = downlevelRA as RuleActionMoveData;

            if (ruleActionMoveData != null)
            {
                if (folderIsLocal)
                {
                    return(new RuleActionInMailboxMoveData
                    {
                        FolderEntryID = ruleActionMoveData.FolderEntryID
                    });
                }
                return(new RuleActionExternalMoveData
                {
                    FolderEntryID = ruleActionMoveData.FolderEntryID,
                    StoreEntryID = ruleActionMoveData.StoreEntryID
                });
            }
            else
            {
                RuleActionCopyData ruleActionCopyData = downlevelRA as RuleActionCopyData;
                if (folderIsLocal)
                {
                    return(new RuleActionInMailboxCopyData
                    {
                        FolderEntryID = ruleActionCopyData.FolderEntryID
                    });
                }
                return(new RuleActionExternalCopyData
                {
                    FolderEntryID = ruleActionCopyData.FolderEntryID,
                    StoreEntryID = ruleActionCopyData.StoreEntryID
                });
            }
        }