在我的Outlook加载项中,我调出SelectNamesDialog来选择GAL上的联系人集。我想执行高级查找以查找特定公司联系人的示例(请参见屏幕截图)。 你知道这是否真的可行吗?我有缺失的界面吗?你可以通过一些不成功的关系查看我的代码。
Outlook.SelectNamesDialog snd = Globals.ThisAddIn.Application.Session.GetSelectNamesDialog();
Outlook.AddressList contactsAddrList = null;
Outlook.AddressList gal = Globals.ThisAddIn.Application.Session.GetGlobalAddressList();
String company = "My Company";
// Try to look > Dead code not working
//Outlook.MAPIFolder galFolder = Globals.ThisAddIn.Application.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.);
//String sScope = "SCOPE ('shallow traversal of " + (char)34 + + (char)34 + "')";
//String sFilter = (char)34 + "urn:content-classes:person" + (char)34 + " LIKE 'RE:%'";
//Outlook.Search search = Globals.ThisAddIn.Application.AdvancedSearch(sScope, sFilter, false, company);
//contactsAddrList = search.Save(company).;
// Set InitialAddressList to Contacts folder AddressList.
snd.SetDefaultDisplayMode(Outlook.OlDefaultSelectNamesDisplayMode.olDefaultSingleName);
snd.InitialAddressList = contactsAddrList;
snd.AllowMultipleSelection = false;
snd.ForceResolution = true;
snd.ShowOnlyInitialAddressList = true;
snd.Display();
答案 0 :(得分:0)
无法调用Outlook对象模型甚至是赎回 您可以在扩展MAPI级别(C ++或Delphi)上执行此操作 - 以IMAPIContainer打开PR_SEARCH属性,设置各种属性(PR_DISPLAY_NAME,PR_ACCOUNT等),然后调用IMAPIContainer :: GetContentsTable。