zoukankan      html  css  js  c++  java
  • Differenciate or distinguish between outlook attachment and embedded image/signature using property accessor in C#.NET

    These days, outlook emails are composed in three formats; plain text, html and rtf (rich text format). If an email is in rtf and it has attachments, as well as, embedded image or signature, it poses a problem in outlook automation. When you are reading attachments in an outlook automation program, your program will recognize the embedded image/signature as an attachment. Although, it is not an attachment from the sender. So, you need to apply some sort of filtering in your loop. Here it is……
    
    using System;
    using System.Collections.Generic;
    using Outlook = Microsoft.Office.Interop.Outlook;
    using System.IO;
    
                Outlook.MailItem item = null;
                Outlook.PropertyAccessor prop;
    
               // intialize item to a mail item
                foreach (Outlook.Attachment atmt in item.Attachments)
                {
                                prop = atmt.PropertyAccessor;
    
                                string contentID = (string)prop.GetProperty(“http://schemas.microsoft.com/mapi/proptag/0x3712001E“);
    
                                if (contentID != “”)
                                    continue;
    
                                else
    
                                       //do something
    
                                ; 
    
            }
    
    If the ContentID is not found, it is not an actual attachment, rather an embedded image/signature.
  • 相关阅读:
    JAVA类型转换
    ASCII码表
    Java运算符的优先级(从高到低)
    Java内各种进制的表示
    java 标识符命名规则
    Java介绍(重要特点)
    多线程
    Mac&iOS之多线程--转自http://geeklu.com/2012/02/thread/
    00002-20180324-数组-列表
    00001-20180324-从列表中获取单个元素
  • 原文地址:https://www.cnblogs.com/lee2011/p/10655113.html
Copyright © 2011-2022 走看看