简体   繁体   English

C#Outlook 2010获取完整的全局地址列表信息

[英]C# Outlook 2010 get FULL Global Address List Inforamtion

I have a some problem - I need to receive FULL global address list from outlook 2010 on my machine. 我有一个问题-我需要在计算机上从Outlook 2010接收完整的全局地址列表。 I mean all field: 我的意思是所有领域:

Title,"First Name","Middle Name","Last Name","Suffix","Company","Department","Job Title","Business Street","Business Street 2","Business Street 3","Business City","Business State","Business Postal Code","Business Country/Region","Home Street","Home 标题,“名字”,“中间名”,“姓氏”,“后缀”,“公司”,“部门”,“职位名称”,“商业街”,“商业街2”,“商业街3” ,“商业城市”,“商业州”,“商业邮政编码”,“商业国家/地区”,“家庭街”,“家庭”

If I trying export GAL from outlook I can get this list. 如果我尝试从Outlook导出GAL,则可以获得此列表。 But How I can do this via C#? 但是如何通过C#做到这一点呢?

I'm trying like this: 我正在尝试这样:

        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);
        }

But every AddressEntries[i] contain only Name, Email and nothin else. 但是每个AddressEntries [i]仅包含Name,Email和其他。

Use AddressEntry.PropertyAccessor to retrieve any available MAPI property. 使用AddressEntry.PropertyAccessor检索任何可用的MAPI属性。 Eg to retrieve the fist name, retrieve the PR_GIVEN_NAME_W property (= 0x3A06001F). 例如,要检索拳头名称,请检索PR_GIVEN_NAME_W属性(= 0x3A06001F)。 Have a look at the address book objects with MFCMAPI or OutlookSpy to figure out what is available and what the property tags are. 使用MFCMAPI或OutlookSpy查看通讯簿对象,以确定可用的对象和属性标签的对象。

givenName = AddressEntry.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A06001F")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM