[英]How to fetch exact match of addressEntry object from GAL (Global Address List)
I want to search for an addressEntry object in global address list using below code in C#. 我想在C#中使用以下代码在全局地址列表中搜索addressEntry对象。
Microsoft.Office.Interop.Outlook.Application app = new Outlook.Application(); Outlook.AddressList gal = app.Session.GetGlobalAddressList(); Outlook.AddressEntry entry = gal.AddressEntries[name];
But i got the 1st matched name which is not correct. 但是我得到了第一个匹配的名字,这是不正确的。 I want to pass alias or primarySMTPAddress(mailId) as index which is unique .
我想传递别名或primarySMTPAddress(mailId)作为唯一的 索引 。 Give me the method to pass unique value to get exact addressEntry Object.
给我方法传递唯一值以获取确切的addressEntry对象。 Else method to fetch all the matching addressEntry objects.
其他方法来获取所有匹配的addressEntry对象。
And you can suggest the possible index parameters for below snippet. 您还可以为以下代码段建议可能的索引参数。
Outlook.AddressEntry entry = gal.AddressEntries[name];
You need to iterate over all items to find the exact match. 您需要遍历所有项目以找到完全匹配的项目。 The Outlook object model doesn't provide any method or property for that.
Outlook对象模型不为此提供任何方法或属性。
Using a low-level code (Extended MAPI) as Dmitry suggested you can create a RES_PROPERTY restriction on PR_ANR and call IMAPITable::Restrict on the contents table of the corresponding IABContainer object. 建议使用低级代码(扩展MAPI)作为Dmitry,您可以在PR_ANR上创建RES_PROPERTY限制,并在相应IABContainer对象的内容表上调用IMAPITable :: Restrict。 This is the same restriction used by Outlook when it resolves a name against a particular container and shows an ambiguous name dialog.
这与Outlook在针对特定容器解析名称并显示模糊的名称对话框时使用的限制相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.