代码之家  ›  专栏  ›  技术社区  ›  McAden

C Outlook 2007-如何直接从加载项访问附件内容?

  •  3
  • McAden  · 技术社区  · 15 年前

    我正在尝试解析基于文本的文件附件(txt、doc等…)。然而,我似乎无法了解二进制信息本身。我可以得到文件名,我可以将文件保存到某个临时文件夹中,然后从那里打开它,但这看起来很混乱。

    有没有什么方法可以在不保存、阅读、删除附件的情况下访问附件的内容,或者我只是在追逐我的尾巴?

    2 回复  |  直到 9 年前
        1
  •  3
  •   76mel    15 年前

    赎回将在此处帮助您,safemailitem.attachments集合具有属性“astext”的附件对象 退房

    http://www.dimastr.com/redemption/

    76MeL

        2
  •  3
  •   Aamol    9 年前

    可以使用Microsoft架构获取附件的内容-

       private void GetAttachmentContent(Attachments attachments)
        {
            foreach (Attachment attachment in attachments)
            {
                //microsoft schema to get the attachment content
                string AttachSchema = "http://schemas.microsoft.com/mapi/proptag/0x37010102";
                byte[] filebyte = (byte[])attachment.PropertyAccessor.GetProperty(AttachSchema);
            }
        }
    

    您需要在代码文件中引用:microsoft.csharp.dll

    推荐文章