예제 #1
0
        private void StampReplyTemplateGuid(MessageItem template)
        {
            this.replyTemplateGuid = Guid.NewGuid();
            template.OpenAsReadWrite();
            template.SafeSetProperty(ItemSchema.ReplyTemplateId, this.replyTemplateGuid.ToByteArray());
            ConflictResolutionResult conflictResolutionResult = template.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult != ConflictResolutionResult.Success)
            {
                base.Context.TraceDebug <string, string>("Failed to stamp the Guid on the reply template message for the rule {0} on the folder {1}. Skipping updating the rule action with the Guid.", base.Context.CurrentRule.Name, base.Context.CurrentFolderDisplayName);
            }
            else
            {
                base.Context.TraceDebug("Successfully stamped the Guid on the template message, now updating the rule action with the guid.");
                this.UpdateRuleAction(RuleActionConverter.GetReplyTemplateStoreObjectId(this.messageTemplateEntryId));
            }
            template.Load(StoreObjectSchema.ContentConversionProperties);
        }
예제 #2
0
 private void UpdateRuleAction(StoreObjectId replytemplateMessageId)
 {
     using (IModifyTable ruleTable = base.Context.CurrentFolder.GetRuleTable(null))
     {
         RuleAction       ruleAction = base.Context.CurrentRule.Actions[base.ActionIndex];
         RuleAction.Reply reply      = (RuleAction.Reply)ruleAction;
         RuleAction[]     value      = new RuleAction[]
         {
             new RuleAction.ReplyAction(reply.UserFlags, RuleActionConverter.MapiReplyFlagsToReplyFlags(reply.Flags), replytemplateMessageId, this.replyTemplateGuid)
         };
         PropValue[] propValues = new PropValue[]
         {
             new PropValue(InternalSchema.RuleId, base.Context.CurrentRule.ID),
             new PropValue(InternalSchema.RuleActions, value)
         };
         ruleTable.ModifyRow(propValues);
         ruleTable.ApplyPendingChanges();
     }
     base.Context.TraceDebug("Successfully updated the rule action with TemplateMessageId and/or Guid");
 }