Outlook - 如何访问自动完成的地址列表
Outlook - How to access the auto-complete address list
我希望能够访问在电子邮件中的“收件人”、“抄送”或“密件抄送”行中键入内容时出现的自动完成地址列表。我希望能够像访问 Outlook 中的其他地址列表一样提取此数据。
谁能确认这是否可行,如果可行,我该怎么做。
这是我目前从各种其他地址列表中提取电子邮件地址的方式。
foreach (Outlook.AddressEntry item in addressList.AddressEntries)
{
using (item.ComDisposable())
{
switch (item.AddressEntryUserType)
{
case Outlook.OlAddressEntryUserType.olExchangeUserAddressEntry:
case Outlook.OlAddressEntryUserType.olExchangeRemoteUserAddressEntry:
var exUser = item.GetExchangeUser();
Debug.WriteLine(exUser.PrimarySmtpAddress, "_GetOutlookContacts");
yield return new EGContact(exUser.Name, exUser.PrimarySmtpAddress, item.ID);
break;
case Outlook.OlAddressEntryUserType.olOutlookContactAddressEntry:
var contact = item.GetContact();
yield return new EGContact(contact.FullName, contact.Email1Address, item.ID);
break;
case Outlook.OlAddressEntryUserType.olExchangeDistributionListAddressEntry:
break;
default:
break;
}
}
}
在早期版本的 Outlook 中,此信息存储在本地 .NK2 文件中。在 Outlook 2010 及更高版本中,此信息存储在您的邮箱中(自动完成流)。有关详细信息,请参阅 Clearing AutoComplete and other Recipient Caches。
您可以使用 Recipients 集合(请参阅 MailItem class 的相应 属性)来访问输入到“收件人”、“抄送”或“密件抄送”字段的数据。
自动完成流作为隐藏(关联)消息存储在收件箱文件夹中,消息 class 为“IPM.Configuration.Autocomplete”。您可以在 OutlookSpy 中看到数据(我是它的作者):转到收件箱文件夹,单击 OutlookSpy 功能区上的 IMAPIFolder 按钮,转到“关联内容”选项卡,找到带有 PR_MESSAGE_CLASS 的邮件== "IPM.Configuration.Autocomplete", select PR_ROAMING_BINARYSTREAM 属性 查看其内容。
您可以使用 Outlook 对象模型 (MAPIFolder.GetStorage("IPM.Configuration.Autocomplete", OlStorageIdentifierType.olIdentifyByMessageClass
) 打开该邮件,使用 PropertyAccessor.GetProperty
阅读 属性,然后解析它。请注意,无法使用 PropertyAccessor 打开大型自动完成流。
如果使用 Redemption an option (I am also its author), it exposes autocomplete as the RDONicknames 集合:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Nicknames = Session.GetNicknames
for each NickName in NickNames
Debug.Print NickName.Name & " - " & NickName.SmtpAddress
next
我希望能够访问在电子邮件中的“收件人”、“抄送”或“密件抄送”行中键入内容时出现的自动完成地址列表。我希望能够像访问 Outlook 中的其他地址列表一样提取此数据。
谁能确认这是否可行,如果可行,我该怎么做。
这是我目前从各种其他地址列表中提取电子邮件地址的方式。
foreach (Outlook.AddressEntry item in addressList.AddressEntries)
{
using (item.ComDisposable())
{
switch (item.AddressEntryUserType)
{
case Outlook.OlAddressEntryUserType.olExchangeUserAddressEntry:
case Outlook.OlAddressEntryUserType.olExchangeRemoteUserAddressEntry:
var exUser = item.GetExchangeUser();
Debug.WriteLine(exUser.PrimarySmtpAddress, "_GetOutlookContacts");
yield return new EGContact(exUser.Name, exUser.PrimarySmtpAddress, item.ID);
break;
case Outlook.OlAddressEntryUserType.olOutlookContactAddressEntry:
var contact = item.GetContact();
yield return new EGContact(contact.FullName, contact.Email1Address, item.ID);
break;
case Outlook.OlAddressEntryUserType.olExchangeDistributionListAddressEntry:
break;
default:
break;
}
}
}
在早期版本的 Outlook 中,此信息存储在本地 .NK2 文件中。在 Outlook 2010 及更高版本中,此信息存储在您的邮箱中(自动完成流)。有关详细信息,请参阅 Clearing AutoComplete and other Recipient Caches。
您可以使用 Recipients 集合(请参阅 MailItem class 的相应 属性)来访问输入到“收件人”、“抄送”或“密件抄送”字段的数据。
自动完成流作为隐藏(关联)消息存储在收件箱文件夹中,消息 class 为“IPM.Configuration.Autocomplete”。您可以在 OutlookSpy 中看到数据(我是它的作者):转到收件箱文件夹,单击 OutlookSpy 功能区上的 IMAPIFolder 按钮,转到“关联内容”选项卡,找到带有 PR_MESSAGE_CLASS 的邮件== "IPM.Configuration.Autocomplete", select PR_ROAMING_BINARYSTREAM 属性 查看其内容。
您可以使用 Outlook 对象模型 (MAPIFolder.GetStorage("IPM.Configuration.Autocomplete", OlStorageIdentifierType.olIdentifyByMessageClass
) 打开该邮件,使用 PropertyAccessor.GetProperty
阅读 属性,然后解析它。请注意,无法使用 PropertyAccessor 打开大型自动完成流。
如果使用 Redemption an option (I am also its author), it exposes autocomplete as the RDONicknames 集合:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Nicknames = Session.GetNicknames
for each NickName in NickNames
Debug.Print NickName.Name & " - " & NickName.SmtpAddress
next