如何在Outlook的缓存条目中阅读,然后将其保存为我的通讯录中的联系人?

发布于 2025-02-05 16:16:05 字数 922 浏览 1 评论 0 原文

我目前正在Visual Studio中使用C#编程Outlook加载项。现在,我想在缓存的现有条目中阅读,以便自动保存其中包含的联系人作为我的通讯录中的条目。谁能进一步帮助我如何访问缓存然后实施我的功能?

到目前为止,我已经做了以下步骤:

public partial class ThisAddIn
{
...
private Outlook.Application OutlookApplication;
private MAPIFolder inboxFolder;
...
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
...
 inboxFolder = Application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderInbox);
...
}

private void saveContact()
{
StorageItem storage = inboxFolder.GetStorage("IPM.Configuration.Autocomplete", OlStorageIdentifierType.olIdentifyByEntryID);
PropertyAccessor propertyAcc = storage.PropertyAccessor;
byte[] got = propertyAcc.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7C090102");
}

我目前正在调用打开检查员时测试的方法。

到目前为止,我收到以下错误消息: system.runtime.interopservices.comexception:“存储列表无法在此文件夹中创建。要么只读取文件夹,要么不允许在此文件夹中存储项目。”

有人可以帮助我解决错误吗?

I am currently programming an Outlook Add-in with C# in Visual Studio. Now I would like to read in existing entries of the cache in order to automatically save the contacts contained therein as an entry in my address book. Can anyone help me further on how I can access the cache and then implement my function?

So far I already did following steps:

public partial class ThisAddIn
{
...
private Outlook.Application OutlookApplication;
private MAPIFolder inboxFolder;
...
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
...
 inboxFolder = Application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderInbox);
...
}

private void saveContact()
{
StorageItem storage = inboxFolder.GetStorage("IPM.Configuration.Autocomplete", OlStorageIdentifierType.olIdentifyByEntryID);
PropertyAccessor propertyAcc = storage.PropertyAccessor;
byte[] got = propertyAcc.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7C090102");
}

I am currently calling the method for testing when opening an inspector.

So far I get the following error message:
System.Runtime.InteropServices.COMException: "The StorageItem item cannot be created in this folder. Either the folder is read-only, or storage items are not allowed in this folder. "

Can somebody help me fix my error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

昇り龍 2025-02-12 16:16:05

自动完整(昵称)缓存流在隐藏的消息中存储在收件箱文件夹中的 ipm.configuration.autocomplete 的消息类中(请参阅文件夹的关联内容)。该格式已记录,请参见。您可以使用 mapifolder.getStorage 访问该消息,然后可以获取流本身:

Set propAcc = storage.PropertyAccessor
Set got = propertyAcc.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7C090102")

您可以找到获取VBA中Outlook的自动完成地址线程有帮助。

The autocomplete (nickname) cache stream is stored in a hidden message with the message class of IPM.Configuration.Autocomplete in the Inbox folder (see the associated content of the folder). The format is documented, see Nickname cache. You can access that message using MAPIFolder.GetStorage and then you can get the stream itself:

Set propAcc = storage.PropertyAccessor
Set got = propertyAcc.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7C090102")

You may find the Get autocomplete address list of Outlook in VBA thread helpful.

横笛休吹塞上声 2025-02-12 16:16:05

AutoCotePote流以的“ IPM.Configuration.autocomplete” 在收件箱文件夹中的消息类中存储为隐藏的(关联)消息。您可以在 pr_roaming_binarystream 属性属性以查看其内容。

您可以使用Outlook Object模型( mapifolder.getStorage(“ ipm.configuration.autocomplete”,olstorageidentifiertype.olidentifybymessageclass )打开该消息,使用 property> property> 解析。

然后 noreferrer“>赎回一个选项(我也是它的作者),它以 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

Autocomplete stream is stored as a hidden (associated) message with the message class of "IPM.Configuration.Autocomplete" in the Inbox folder. You can see the data in OutlookSpy (I am its author): go to the Inbox folder, click IMAPIFolder button on the OutlookSpy ribbon, go to the "Associated Contents" tab, locate a message with PR_MESSAGE_CLASS == "IPM.Configuration.Autocomplete", select the PR_ROAMING_BINARYSTREAM property to see its contents.

You can open that message using the Outlook Object Model (MAPIFolder.GetStorage("IPM.Configuration.Autocomplete", OlStorageIdentifierType.olIdentifyByMessageClass), read the property using PropertyAccessor.GetProperty, then parse it. Note that large (>30kB) autocomplete streams cannot be opened using PropertyAccessor.

If using Redemption an option (I am also its author), it exposes autocomplete as the RDONicknames collection:

 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文