Пример #1
0
        private void CreateDAM()
        {
            MailboxSession mailboxSession = base.Context.StoreSession as MailboxSession;

            base.Context.TraceDebug("Deferred action: Creating deferred action message.");
            using (DeferredAction deferredAction = RuleMessageUtils.CreateDAM(mailboxSession, this.folder.Id.ObjectId, this.provider))
            {
                foreach (DeferredActionWorkItem.ActionInfo actionInfo in this.actions)
                {
                    base.Context.TraceDebug <RuleAction>("Deferred action: Adding deferred action {0}.", actionInfo.Action);
                    deferredAction.AddAction(actionInfo.RuleId, actionInfo.Action);
                }
                StoreId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox);
                bool    flag            = RuleUtil.EqualsStoreId(defaultFolderId, base.Context.FinalDeliveryFolderId);
                deferredAction.Message[ItemSchema.DeferredActionMessageBackPatched] = !flag;
                base.Context.DeliveredMessage.Load(DeferredError.EntryId);
                byte[] value = (byte[])base.Context.DeliveredMessage[StoreObjectSchema.EntryId];
                deferredAction.Message[ItemSchema.OriginalMessageEntryId] = value;
                base.Context.TraceDebug("Deferred action: Saving deferred action message.");
                deferredAction.SerializeActionsAndSave();
                base.Context.TraceDebug("Deferred action: Deferred action message saved.");
            }
        }