无法在Outlook加载项中创建StorageItem [英] Cannot create StorageItem in Outlook Add-In

查看:132
本文介绍了无法在Outlook加载项中创建StorageItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行以下代码:

I'm trying to run this code:

this.storage =
            Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
           .GetStorage("ws_up_storage", Outlook.OlStorageIdentifierType.olIdentifyByMessageClass);

它在某些机器上运行得很好,但在其他机器上会抛出此异常:

It runs perfectly well on some machines, but on others it throws this exception:

我还尝试了其他文件夹名称,例如olFolderInboxolFolderCalendar.我已经查看了Microsoft文档,并说如果文件夹为以下文件之一,则将出现此错误:

I also tried other folder names, like olFolderInbox, olFolderCalendar. I've looked at Microsoft docs for this, and it says this error is to be expected if the folder is one of the following:

  • 该文件夹是Microsoft Exchange公用文件夹,Internet邮件访问协议(IMAP),MSN Hotmail或Microsoft SharePoint Foundation文件夹.
  • 该文件夹的用户权限是只读的.
  • 商店提供商不支持隐藏的物品.

可悲的事实是,我不知道如何检查其中哪一项是正确的,以及是否有可能.

The sad fact is, I do not know how to check which one of these is true and if it's at all possible.

我将如何确定问题的原因并加以解决?

How would I go about determining the cause of the problem and addressing it?

推荐答案

错误0x80040102是MAPI_E_NO_SUPPORT,这意味着商店不支持隐藏(关联)的项目.

The error 0x80040102 is MAPI_E_NO_SUPPORT, which means the store does not support hidden (associated) items.

使用PropertyAccessor.GetProperty读取PR_MDB_PROVIDER属性(DASL名称为http://schemas.microsoft.com/mapi/proptag/0x34140102).返回的16个字节的数组将特定于每种商店类型.例如.对于Exchange存储,它将为pbExchangeProviderPrimaryUserGuid(5494A1C0297F101BA58708002B2A2517).使用 OutlookSpy (单击IMessage,IMAPIFolder或IMsgStore)查看有问题的商店中的任何对象参见PR_MDB_PROVIDER属性.

Read the PR_MDB_PROVIDER property (DASL name http://schemas.microsoft.com/mapi/proptag/0x34140102) using PropertyAccessor.GetProperty. The returned 16 byte array will be specific for each store kind. E.g. for an Exchange store, it will be pbExchangeProviderPrimaryUserGuid (5494A1C0297F101BA58708002B2A2517). Take a look at any object in the store in question using OutlookSpy (click IMessage, IMAPIFolder, or IMsgStore) to see the PR_MDB_PROVIDER property.

这篇关于无法在Outlook加载项中创建StorageItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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