我有一些问题 - 我需要在我的机器上从 Outlook 2010 接收完整的全球地址列表。我的意思是所有领域:
职称,"名","中间名","姓氏","后缀","公司","部门","职务","商业街","商业街2","商业街3" ,"商业城市","商业州","商业邮政编码","商业国家/地区","家乡","家乡
如果我尝试从 Outlook 导出 GAL,我可以得到这个列表。但是我如何通过 C# 做到这一点?
我正在尝试这样:
Application oApp = new Application();
NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon("Name", "Pass", false, true);
AddressLists oDLs = oNS.AddressLists;
AddressList oGal = oDLs["Global Address List"];
string sDL = "TestDL";
AddressEntries oEntries = oGal.AddressEntries;
AddressEntry oDL = oEntries[sDL];
oEntries = oDL.Members;
AddressEntry oEntry = default(AddressEntry);
for (i = 1; i <= oGal.AddressEntries.Count ; i++ )
{
oEntry = oGal.AddressEntries[i];
//listBox1.Items.Add(oEntry.Name);
}
但是每个 AddressEntries[i] 只包含姓名、电子邮件,没有其他内容。