简体   繁体   中英

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. 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

If I trying export GAL from outlook I can get this list. But How I can do this via 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.

Use AddressEntry.PropertyAccessor to retrieve any available MAPI property. Eg to retrieve the fist name, retrieve the PR_GIVEN_NAME_W property (= 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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