Outlook Interop - 检查EntryID是否仍存在项目 [英] Outlook Interop - Check if item still exist by EntryID

查看:47
本文介绍了Outlook Interop - 检查EntryID是否仍存在项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


有没有办法检查EntryID项目是否仍然存在?


我知道我可以尝试获取它来自命名空间GetItemFromID并且如果它不存在则捕获ComExcepti,但我不确定这是最好的方法。


我不想检索项目,只是检查它是否仍然在商店。


谢谢。


解决方案

您好,


  NameSpace.GetItemFromID  方法是一种合理的方法,因为来自OOM的搜索方法不支持二进制属性
(如EntryID)。




EntryID
会发生变化,例如,来自
收件箱  到Microsoft
Exchange Server公用文件夹,或从一个个人文件夹(.pst)文件到另一个.pst文件。解决方案不应该依赖于
EntryID  属性
是唯一的,除非项目不会被移动。


我建议使用低级别的属性 -   PR_SEARCH_KEY  。  MAPI
使用特定的规则来构建邮件收件人的搜索键。搜索键是通过连接地址类型(以大写字符表示),冒号字符':',电子邮件形成的。规范形式的地址和终止空字符。
这里的规范形式表示区分大小写的地址出现在正确的大小写中,并且不区分大小写的地址转换为大写。这对于保持相关性很重要消息。


MAPI消息对象将在创建时分配一个唯一值 PR_SEARCH_KEY
如果复制对象,也会复制此属性值。 


Hi,

Is there a way to check if item still exist by the EntryID?

i know i can try get it from namespace GetItemFromID and catch ComExceptiion if it's not exist, but i am not sure this is the best way.

I don't want to retrieve the item as well just check if it still in the Store.

Thanks.

解决方案

Hello,

The NameSpace.GetItemFromID method is a reasonable way to go because search methods from the OOM don't support binary properties (like EntryID).

The EntryID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved.

I'd suggest using a low-level property instead - PR_SEARCH_KEY . MAPI uses specific rules for constructing search keys for message recipients. The search key is formed by concatenating the address type (in uppercase characters), the colon character ':', the e-mail address in canonical form, and the terminating null character. Canonical form here means that case-sensitive addresses appear in the correct case, and addresses that are not case-sensitive are converted to uppercase. This is important in preserving correlations among messages.

A MAPI message object will have a unique value assigned on creation for PR_SEARCH_KEY, and if the object is copied this property value is copied as well. 


这篇关于Outlook Interop - 检查EntryID是否仍存在项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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