示例#1
0
        protected override SoftDeleteMailboxRemovalCheckRemoval CheckRemoval()
        {
            DirectoryIdentity targetDatabase  = base.Data.TargetDatabase;
            DirectoryMailbox  mailbox         = base.TargetDatabase.GetMailbox(base.Data.MailboxIdentity);
            IPhysicalMailbox  physicalMailbox = mailbox.PhysicalMailboxes.FirstOrDefault((IPhysicalMailbox mbx) => mbx.Guid == base.Data.MailboxIdentity.Guid);

            if (physicalMailbox == null)
            {
                return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval("An active mailbox for {0} could not be found.", new object[]
                {
                    base.Data.MailboxIdentity
                }));
            }
            if (base.Data.ItemCount > (long)physicalMailbox.ItemCount)
            {
                string reasonMessage = "Cannot remove soft deleted mailbox {0} because its ItemCount is {1} which is greater than the active copy's ItemCount of {2} on database '{3}'.";
                return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval(reasonMessage, new object[]
                {
                    base.Data.MailboxIdentity.Guid,
                    base.Data.ItemCount,
                    physicalMailbox.ItemCount,
                    targetDatabase.Name
                }));
            }
            return(null);
        }
示例#2
0
 protected override SoftDeleteMailboxRemovalCheckRemoval CheckRemoval()
 {
     if (base.Data.DisconnectDate == null)
     {
         return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval("Cannot remove soft deleted mailbox {0} because it does not have a disconnect date.", new object[]
         {
             base.Data.MailboxIdentity
         }));
     }
     if (base.Data.DisconnectDate > this.removalCutoffDate)
     {
         string reasonMessage = "Cannot remove soft deleted mailbox {0} because its DisconnectDate is {1} and the minimum date for removal is {2}.";
         return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval(reasonMessage, new object[]
         {
             base.Data.MailboxIdentity,
             base.Data.DisconnectDate,
             this.removalCutoffDate
         }));
     }
     return(null);
 }