在C#中访问Outlook 2013中的电子邮件VSTO的原始邮件来源 [英] Access raw mail source of email VSTO add in for outlook 2013 in C#

查看:146
本文介绍了在C#中访问Outlook 2013中的电子邮件VSTO的原始邮件来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


大家好,

Hi All,


我的要求是我想在windows 2013中访问outlook 2013中的原始mime邮件源(如果你右键点击任何电子邮件然后点击"查看源代码",你可以找到相同的东西)。在Mac的Outlook 15.29中)。我的问题是,我已经找到了使用Mapi标头获取
标题部分的方法,但无法找到整个主体的原始源。

My requirement is that I want to access raw mime source of mail in outlook 2013 in windows(you can find same stuff if you right click on any email and then click on "view source" in outlook 15.29 in Mac). My problem is that I have found way to get the header part using Mapi headers but not able to find raw source for whole body.


有些链接建议使用0X1000001E和0X0000001F(带MAPI接口) )可以访问正文部分,但在尝试时,它给了我未经授权的访问权限。

Some link have suggested that using 0X1000001E and 0X0000001F (with MAPI interfaces) can give access to body part, but while trying it, it gives me exception of unauthorized access.


有些链接也说MAPI属性不支持它,因为他们不知道身体部位有多大。但我怀疑这是非常古老的帖子。我有我的vsto添加(在C#中)我正在使用MailItem对象。

Some links are also saying that MAPI properties does not support it as they dont know how big body part would be. However I doubt as it is very old post. I have my vsto add in (in C#) and I am using MailItem object.


在某些论坛中,人们建议windows不存储原始的mime源。我还使用了registery键" SaveAllMimeNotJustHeaders "。
但即使在我点击Windows中的查看邮件来源之后,我也只能看到身体的html部分。

In some forum, people have suggested that windows does not store raw mime source. I have also used registery key "SaveAllMimeNotJustHeaders". But even after when I click on view source of mail in windows, I am only able to see html part of body.


你能告诉我我的vsto添加的任何工作吗得到原始的mime邮件来源(C#或C ++,对我来说一切都很好)。如果没有那么这是outlook 2013或windows的限制吗?我们可以在Mac中看到前景15.29中的原始mime源。 

Can you please suggest me any work around by which my vsto add in can get raw mime source of mail (C# or C++ anything is fine with me). If not then is this a limitation of outlook 2013 or windows ? As we can see raw mime source in outlook 15.29 in Mac. 


请帮忙。

推荐答案

您好,

OOM(也不是MAPI)不提供任何属性。您可以做的最好的方法是将邮件项目保存到磁盘,请参阅

MailItem.SaveAs
允许将Microsoft Outlook项目以指定的文件类型的格式运行到指定的路径。如果未指定文件类型,则使用MSG格式(.msg)。

The OOM (nor MAPI) doesn't provide any property for that. The best what you can do is to save the mail item to a disk, see MailItem.SaveAs which allows to save the Microsoft Outlook item to the specified path and in the format of the specified file type. If the file type is not specified, the MSG format (.msg) is used.

要获取MIME表示,您需要来创建它在您自己的代码中一次添加一个属性。即
您将需要明确构建所有标头和MIME部分。 您也可以使用现有的MIME转换器。但是,它们不会转换Outlook邮件项目 在一个电话中(例如,Lumisoft)。

To get a MIME representation you need to create it on your own in the code adding one property at a time. I.e. you will need to expliclty build all the headers and MIME parts. You can also use existing MIME converters. However, they will not convert Outlook mail items in a single call (for example, Lumisoft).

查看  在Outlook加载项中以MIME格式保存邮件(* .eml)以获取更多可能的选项。

Take a look at the  Save Mail in MIME format (*.eml) in Outlook Add-In page for more possible options.

扩展MAPI提供
PR_TRANSPORT_MESSAGE_HEADERS
属性,允许
获取整个Internet邮件头集合,例如VBA宏:

Sub DemoPropertyAccessorGetProperty()  
 Dim PropName, Header As String  
 Dim oMail As Object  
 Dim oPA As Outlook.PropertyAccessor  
 'Get first item in the inbox  
 Set oMail = _  
 Application.Session.GetDefaultFolder(olFolderInbox).Items(1)  
 'PR_TRANSPORT_MESSAGE_HEADERS  
 PropName = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"  
 'Obtain an instance of PropertyAccessor class  
 Set oPA = oMail.PropertyAccessor  
 'Call GetProperty  
 Header = oPA.GetProperty(PropName)  
 Debug.Print (Header)  
End Sub


这篇关于在C#中访问Outlook 2013中的电子邮件VSTO的原始邮件来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆