View Single Post
  #3  
Old June 3rd 08, 02:07 AM posted to microsoft.public.outlook.program_addins
Aamir[_2_]
external usenet poster
 
Posts: 4
Default MAPI question about extra info in email and smtp address

Sorry for the delay - here is the basic gist of what I have. I looked
online and found a few caveats on using cached exchange mode - any
insights you have about that and this in general are very
appreciated.

Thanks so much to any and all with input.

private ListString GetRecipientAddresses(RDOMail rdoMail){
MAPITable mapiTable = rdoMail.Recipients.MAPITable;
mapiTable.Columns = { PR_ADDRTYPE_W, PR_DISPLAY_NAME_W,
PR_SMTP_ADDRESS_W, PR_EMAIL_ADDRESS_W, PR_RECIPIENT_TYPE,
PR_DISPLAY_TYPE };
mapiTable.GoToFirst();

ListString addresses = new ListString();

Object[] rows;
while((rows = (Object[])mapiTable.GetRows(32)) != null) {
foreach(Object[] row in rows) {
// the following line just sets up a dictionary for key -
value mappings
IPropertyMap propertyMap = new
KeyValueRowSource(desiredPropertyKeys, row);
String address = GetAddress(propertyMap);
addresses.Add(address);
}
}

return addresses;
}

private static String GetAddress(IPropertyMap recipient) {
String address;

String psAddressType = recipient.GetPropertyString(PR_ADDRTYPE_W)
as String;
switch(psAddressType) {
case "EX":
address = recipient.GetPropertyString(PR_SMTP_ADDRESS_W) as
String;
break;

case "SMTP":
address = recipient.GetPropertyString(PR_EMAIL_ADDRESS_W)
as String;
break;
}

return address;
}
Ads