Example #1
0
        public static DeferredError Create(MailboxSession session, StoreObjectId folderId, string providerName, long ruleId, RuleAction.Type actionType, int actionNumber, DeferredError.RuleError ruleError)
        {
            Util.ThrowOnNullArgument(session, "session");
            Util.ThrowOnNullArgument(folderId, "folderId");
            Util.ThrowOnNullArgument(providerName, "providerName");
            EnumValidator.ThrowIfInvalid <RuleAction.Type>(actionType, "actionType");
            EnumValidator.ThrowIfInvalid <DeferredError.RuleError>(ruleError, "ruleError");
            if (!IdConverter.IsFolderId(folderId))
            {
                throw new ArgumentException(ServerStrings.InvalidFolderId(folderId.ToBase64String()));
            }
            DeferredError deferredError = new DeferredError();

            deferredError.message = MessageItem.Create(session, session.GetDefaultFolderId(DefaultFolderType.DeferredActionFolder));
            deferredError.message[InternalSchema.ItemClass]         = "IPC.Microsoft Exchange 4.0.Deferred Error";
            deferredError.message[InternalSchema.RuleFolderEntryId] = folderId.ProviderLevelItemId;
            deferredError.message[InternalSchema.RuleId]            = ruleId;
            deferredError.message[InternalSchema.RuleActionType]    = (int)actionType;
            deferredError.message[InternalSchema.RuleActionNumber]  = actionNumber;
            deferredError.message[InternalSchema.RuleError]         = ruleError;
            deferredError.message[InternalSchema.RuleProvider]      = providerName;
            return(deferredError);
        }
 public virtual void MarkRuleInError(Rule rule, RuleAction.Type actionType, int actionIndex, DeferredError.RuleError errorCode)
 {
     RuleUtil.MarkRuleInError(rule, this.folder.MapiFolder);
 }
Example #3
0
 public static DeferredError CreateDAE(MailboxSession session, StoreObjectId ruleFolderId, string providerName, long ruleId, RuleAction.Type actionType, int actionNumber, DeferredError.RuleError ruleError)
 {
     return(DeferredError.Create(session, ruleFolderId, providerName, ruleId, actionType, actionNumber, ruleError));
 }
 public virtual void DisableAndMarkRuleInError(Rule rule, RuleAction.Type actionType, int actionIndex, DeferredError.RuleError errorCode)
 {
     this.TraceError <Rule, DeferredError.RuleError>("Rule {0} will be disabled due to error: {1}", rule, errorCode);
     RuleUtil.DisableRule(rule, this.folder.MapiFolder);
     this.MarkRuleInError(rule, actionType, actionIndex, errorCode);
 }
Example #5
0
 public override void MarkRuleInError(Rule rule, RuleAction.Type actionType, int actionIndex, DeferredError.RuleError errorCode)
 {
     base.MarkRuleInError(rule, actionType, actionIndex, errorCode);
     using (DeferredError deferredError = DeferredError.Create(base.StoreSession as MailboxSession, base.CurrentFolder.StoreObjectId, rule.Provider, rule.ID, actionType, actionIndex, errorCode))
     {
         byte[] array = deferredError.Save();
         if (array != null)
         {
             if (this.daeMessageEntryIds == null)
             {
                 this.daeMessageEntryIds = new List <byte[]>();
             }
             this.daeMessageEntryIds.Add(array);
         }
     }
 }