![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
| Tags: address, check, distribution, including, list, lists, recipient |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Basically, In my Application_ItemSend I would like to check if a
particular person or persons are in the recipient list (To or CC). I tried this by looping through mailItem.Recipients and checking each one. Problem is that this won't look inside of distribution lists, so if I send to a distribution list that has this person in it, this won't detect it. How can I do this? Any way to expand the dist. list at this point to look inside, and/or determine if a particular recipient is a dist list? Thanks for your help, Aaron |
| Ads |
|
#2
|
|||
|
|||
|
You can access DL members using the Recipient.AddressEntry.Members
collection Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "PilotYid" wrote in message ups.com... Basically, In my Application_ItemSend I would like to check if a particular person or persons are in the recipient list (To or CC). I tried this by looping through mailItem.Recipients and checking each one. Problem is that this won't look inside of distribution lists, so if I send to a distribution list that has this person in it, this won't detect it. How can I do this? Any way to expand the dist. list at this point to look inside, and/or determine if a particular recipient is a dist list? Thanks for your help, Aaron |
|
#3
|
|||
|
|||
|
Thanks. When I am looping through the recepients on the email, how do I
know if it is a DL so I can know to check the Members collection? Or do all recepients have a Members collection, but are just size 1 for regular addresses? Would you mind giving me a small code sample? Thanks again |
|
#4
|
|||
|
|||
|
For the DLs the Members property is non-NULL.
Or chekc that the AddressEntry.DisplayType property is set to olDistList or olPrivateDistList. sub ProcessAddressEntry(AddressEntry) if (AddressEntry = olDistList) or (AddressEntry = olPrivateDistList) Then for i = 1 to AddressEntry.Members.Count ProcessAddressEntry AddressEntry.Members(i) next Else Debug.Print AddressEntry.Address End If end sub .... for i = 1 to MailItem.Recipients.Count set AddressEntry = MailItem.Recipients(i).AddressEntry if not (AddressEntry Is Nothing) Then ProcessAddressEntry(AddressEntry) End If next Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "PilotYid" wrote in message oups.com... Thanks. When I am looping through the recepients on the email, how do I know if it is a DL so I can know to check the Members collection? Or do all recepients have a Members collection, but are just size 1 for regular addresses? Would you mind giving me a small code sample? Thanks again |
|
#5
|
|||
|
|||
|
Thanks for your help. For some reason, the distribution lists in my
company are showing up as displaytype 0, not DistList or PrivateDistList. Do you have any ideas why this would be? Is there another way to do this? Thanks again Dmitry Streblechenko wrote: For the DLs the Members property is non-NULL. Or chekc that the AddressEntry.DisplayType property is set to olDistList or olPrivateDistList. sub ProcessAddressEntry(AddressEntry) if (AddressEntry = olDistList) or (AddressEntry = olPrivateDistList) Then for i = 1 to AddressEntry.Members.Count ProcessAddressEntry AddressEntry.Members(i) next Else Debug.Print AddressEntry.Address End If end sub ... for i = 1 to MailItem.Recipients.Count set AddressEntry = MailItem.Recipients(i).AddressEntry if not (AddressEntry Is Nothing) Then ProcessAddressEntry(AddressEntry) End If next Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "PilotYid" wrote in message oups.com... Thanks. When I am looping through the recepients on the email, how do I know if it is a DL so I can know to check the Members collection? Or do all recepients have a Members collection, but are just size 1 for regular addresses? Would you mind giving me a small code sample? Thanks again |
|
#6
|
|||
|
|||
|
Are you sure? 0 is olUser. Are you using Exchange? Did you try to test if
the Members collection is non NULL? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "PilotYid" wrote in message ps.com... Thanks for your help. For some reason, the distribution lists in my company are showing up as displaytype 0, not DistList or PrivateDistList. Do you have any ideas why this would be? Is there another way to do this? Thanks again Dmitry Streblechenko wrote: For the DLs the Members property is non-NULL. Or chekc that the AddressEntry.DisplayType property is set to olDistList or olPrivateDistList. sub ProcessAddressEntry(AddressEntry) if (AddressEntry = olDistList) or (AddressEntry = olPrivateDistList) Then for i = 1 to AddressEntry.Members.Count ProcessAddressEntry AddressEntry.Members(i) next Else Debug.Print AddressEntry.Address End If end sub ... for i = 1 to MailItem.Recipients.Count set AddressEntry = MailItem.Recipients(i).AddressEntry if not (AddressEntry Is Nothing) Then ProcessAddressEntry(AddressEntry) End If next Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "PilotYid" wrote in message oups.com... Thanks. When I am looping through the recepients on the email, how do I know if it is a DL so I can know to check the Members collection? Or do all recepients have a Members collection, but are just size 1 for regular addresses? Would you mind giving me a small code sample? Thanks again |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Distribution Lists | tweeks | Outlook - Using Contacts | 12 | December 19th 07 12:59 AM |
| Distribution lists | hdboater | Outlook - Using Contacts | 4 | March 5th 06 08:28 PM |
| distribution lists | Mike | Outlook - Using Contacts | 3 | February 21st 06 04:01 AM |
| create new distribution list in global address lists in exchange | tim | Outlook - Using Contacts | 1 | February 6th 06 09:52 PM |
| how do I print a distribution list from a global address book? | Sue Mosher [MVP-Outlook] | Outlook - Using Contacts | 0 | January 18th 06 05:11 PM |