参考: 的Outlook 2013 视窗8检索自定义属性值(其使用的SetProperty在Outlook VBA设置)
我已使用的SetProperty传出邮件的自定义属性。 一旦在另一台计算机上收到邮件,我就可以在Internet邮件头中看到此属性及其值。 即使该属性及其关联值存在于收到的邮件中,我也无法使用GetProperty检索此属性的值。
物业使用下面的代码设置:
Const SchemaPrefix As String = "http://schemas.microsoft.com/mapi/string/"
Const SchemaCode As String = "{00020386-0000-0000-C000-000000000046}/ABC-ID"
Dim pa As Outlook.PropertyAccessor
Dim ID_Schema As String
Dim ID_Value As String
ID_Schema = SchemaPrefix & SchemaCode
ID_Value = "12345"
Set pa = item.PropertyAccessor
pa.SetProperty ID_Schema, ID_Value
在另一台机器上收到的邮件,我能看到互联网信使报头包含:
ABC-ID: 12345
但是,以下代码失败,并返回错误 - 属性“http://schemas.microsoft.com/mapi/string/ {00020386-0000-0000-C000-000000000046}/ABC-ID”未知或无法找到。发生在最后一行
错误:pa.GetProperty(ID_Schema)
Const SchemaPrefix As String = "http://schemas.microsoft.com/mapi/string/"
Const SchemaCode As String = "{00020386-0000-0000-C000-000000000046}/ABC-ID"
Dim pa As Outlook.PropertyAccessor
Dim ID_Schema As String
Dim objFolder As Folder
ID_Schema = SchemaPrefix & SchemaCode
Set objFolder = Outlook.ActiveExplorer.CurrentFolder
Set pa = objFolder.Items.item(1).PropertyAccessor
MsgBox pa.GetProperty(ID_Schema)
在测试文件夹中,只有一个电子邮件...和我能够手动验证自定义属性和存在的在发送机器上设置的值
在网上找到了一些关于如何设置属性的参考...但没有找到如何检索属性值。指导将非常感谢。
谢谢,先生!您对这个问题的确认和您提出的解决方案(以及及时!)非常感谢。 我有点通过下方后揭去: http://stackoverflow.com/questions/15197356/keep-outlook-mailitem-property-internet-header-from-being-removed-when-forward 这指出作者能够使用GetProperty检索ID集合! 非常感谢! –
如果该属性已经映射到目标邮箱中,GetProperty将会工作 - 这样Exchange/Outlook会将X标头提升为名称MAPI属性。 –