我目前正在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?
发布评论
评论(2)
自动完整(昵称)缓存流在隐藏的消息中存储在收件箱文件夹中的
ipm.configuration.autocomplete
的消息类中(请参阅文件夹的关联内容)。该格式已记录,请参见。您可以使用mapifolder.getStorage
访问该消息,然后可以获取流本身:您可以找到获取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 usingMAPIFolder.GetStorage
and then you can get the stream itself:You may find the Get autocomplete address list of Outlook in VBA thread helpful.
AutoCotePote流以
的“ IPM.Configuration.autocomplete”
在收件箱文件夹中的消息类中存储为隐藏的(关联)消息。您可以在 pr_roaming_binarystream 属性属性以查看其内容。您可以使用Outlook Object模型(
mapifolder.getStorage(“ ipm.configuration.autocomplete”,olstorageidentifiertype.olidentifybymessageclass
)打开该消息,使用property> property> 解析。
然后 noreferrer“>赎回一个选项(我也是它的作者),它以 rdonicknames 集合:
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 thePR_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 usingPropertyAccessor.GetProperty
, then parse it. Note that large (>30kB) autocomplete streams cannot be opened usingPropertyAccessor
.If using Redemption an option (I am also its author), it exposes autocomplete as the RDONicknames collection: