示例#1
0
        private bool IsSharedMailboxSentItemMessage(EmailMessage message, IAgentInfoWriter agentInfo)
        {
            Header header = message.MimeDocument.RootPart.Headers.FindFirst("X-MS-Exchange-SharedMailbox-SentItem-Message");

            if (header == null || string.IsNullOrWhiteSpace(header.Value))
            {
                this.logger.TraceDebug(new string[]
                {
                    "Could not find the expected message header."
                });
                return(false);
            }
            bool flag;

            if (!bool.TryParse(header.Value, out flag) || !flag)
            {
                this.logger.TraceDebug(new string[]
                {
                    "Found the header but the value does not match the expected value. Expected: True, Actual ",
                    header.Value
                });
                return(false);
            }
            string text = "Found the message header with key X-MS-Exchange-SharedMailbox-SentItem-Message value " + header.Value + ". This message will be droped.";

            this.logger.TraceDebug(new string[]
            {
                text
            });
            agentInfo.AddAgentInfo("MessageFlagCheck", text);
            return(true);
        }
示例#2
0
 private MessageItem GetAttachedMessageItem(MessageItem message, IAgentInfoWriter agentInfo)
 {
     foreach (AttachmentHandle handle in message.AttachmentCollection.GetHandles())
     {
         using (Attachment attachment = message.AttachmentCollection.Open(handle))
         {
             ItemAttachment itemAttachment = attachment as ItemAttachment;
             if (itemAttachment != null)
             {
                 return(itemAttachment.GetItemAsMessage());
             }
             string text = "Warning: Message does not contain the expected attachment.";
             this.logger.TraceDebug(new string[]
             {
                 text
             });
             agentInfo.AddAgentInfo("AttachmentCheck", text);
         }
     }
     return(null);
 }