public void OnCreatedMessageHandler(StoreDriverEventSource source, StoreDriverDeliveryEventArgs args)
        {
            StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = (StoreDriverDeliveryEventArgsImpl)args;

            if (RetentonPolicyTagProcessingAgent.IsRetentionPolicyEnabled(storeDriverDeliveryEventArgsImpl.ADRecipientCache, storeDriverDeliveryEventArgsImpl.MailRecipient.Email))
            {
                RetentionTagHelper.ApplyPolicy(storeDriverDeliveryEventArgsImpl.MailboxSession, storeDriverDeliveryEventArgsImpl.RetentionPolicyTag, storeDriverDeliveryEventArgsImpl.RetentionFlags, storeDriverDeliveryEventArgsImpl.RetentionPeriod, storeDriverDeliveryEventArgsImpl.ArchiveTag, storeDriverDeliveryEventArgsImpl.ArchivePeriod, storeDriverDeliveryEventArgsImpl.CompactDefaultRetentionPolicy, storeDriverDeliveryEventArgsImpl.MessageItem);
            }
        }
예제 #2
0
        public void OnCreatedMessageHandler(StoreDriverEventSource source, StoreDriverDeliveryEventArgs args)
        {
            StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = (StoreDriverDeliveryEventArgsImpl)args;
            string arg  = args.MailItem.FromAddress.ToString();
            string text = storeDriverDeliveryEventArgsImpl.MailRecipient.MsgId.ToString();

            UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "OnCreatedMessageHandler: MessageId {0}, Invoked, Sender {1}", text, arg);
            if (this.ShouldProcess(storeDriverDeliveryEventArgsImpl.ADRecipientCache.OrganizationId, args.MailItem, text))
            {
                UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "OnCreatedMessageHandler: MessageId {0}, Sender {1}: This message is coming from unjournal routing agent, we need to process it", text, arg);
                if (this.IsSender(args))
                {
                    UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "OnCreatedMessageHandler: MessageId {0}, Sender {1} : This is a sender, trying to add bcc recipients if needed", text, arg);
                    this.AddBccRecipientsToMessage(args, ((StoreDriverDeliveryEventArgsImpl)args).MessageItem);
                }
                MailboxSession mailboxSession = storeDriverDeliveryEventArgsImpl.MailboxSession;
                ExDateTime     exDateTime;
                if (this.TryGetExpiryDateForMigratedMessage(storeDriverDeliveryEventArgsImpl.MailItem, out exDateTime))
                {
                    UnJournalAgent.Tracer.TraceDebug <string, string, string>(0L, "OnCreatedMessageHandler: MessageId {0}, Sender {1}: This is a migrated message , expiry date exists on this message. ExpiryDate = {2}", text, arg, exDateTime.ToString());
                    MessageItem messageItem = storeDriverDeliveryEventArgsImpl.MessageItem;
                    if (RetentonPolicyTagProcessingAgent.IsRetentionPolicyEnabled(storeDriverDeliveryEventArgsImpl.ADRecipientCache, storeDriverDeliveryEventArgsImpl.MailRecipient.Email))
                    {
                        messageItem.DeleteProperties(new PropertyDefinition[]
                        {
                            StoreObjectSchema.PolicyTag,
                            StoreObjectSchema.ArchiveTag,
                            ItemSchema.RetentionDate,
                            ItemSchema.ArchiveDate
                        });
                        UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "OnCreatedMessageHandler: MessageId {0}, Sender {1}: Deleted Retention Policy Guids", text, arg);
                    }
                    messageItem[ItemSchema.EHAMigrationExpiryDate] = exDateTime;
                    UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "OnCreatedMessageHandler: MessageId {0}, Sender {1}: Stamped migration date", text, arg);
                }
            }
        }