1

我有一些问题 - 我需要在我的机器上从 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] 只包含姓名、电子邮件,没有其他内容。

4

1 回答 1

1

使用 AddressEntry.PropertyAccessor 检索任何可用的 MAPI 属性。例如,要检索拳头名称,请检索 PR_GIVEN_NAME_W 属性 (= 0x3A06001F)。查看带有 MFCMAPI 或OutlookSpy的通讯簿对象,以了解可用的内容和属性标签是什么。

givenName = AddressEntry.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A06001F")
于 2012-07-06T17:05:49.707 回答