contacts : distribution list

Z

zzozo

Hi, all.

My addin is trying to retrieve lastname and firstname from contacts
folder like contact.lastname + contact.firstname. However, if the
contact is a 'distribution list', the addin dies without throwing any
exception. Is there any way to make difference between regular contact
and distribution list?

Thanks in advance,
Seungchan
 
I

Iv Kozhuharov

Yes, of course. When you iterate Outlook items, look for Class Property. For
Contacts Class Property is olContact , for DistributionList -
olDistributionList.



Iv Kozhuharov

IMI Support Team

http://www.imibo.com/imidev/
 
Z

zzozo

Thanks, Iv!

Could you take a look at my test code, and tell me what to do to
distinguish regulart contact and distributionList at <<< >>>? (By
the way, I am testing with outlook 2000.)



NameSpace objNS = applicationObject.GetNamespace("MAPI");
MAPIFolder contacts =
objNS.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
ContactItem c;

MessageBox.Show("" + contacts.Items.Count);

for ( int i=1; i<= contacts.Items.Count; i++ )
{
c = (ContactItem)contacts.Items.Item(i);

<<<<< if ( c.Class == OlItemType.olDistributionListItem ) >>>>>>>
{
MessageBox.Show("Caught distribution item!");
}
else
{
MessageBox.Show(c.FirstName + " " + c.LastName);
}
}


Thank you very much!
Seungchan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top