Reputation: 11
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.
Upvotes: 1
Views: 3208
Reputation: 66286
Use AddressEntry.PropertyAccessor
to retrieve any available MAPI property.
E.g. 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 (I am its author) to figure out what is available and what the property tags are.
givenName = AddressEntry.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A06001F")
Upvotes: 1