-
Nov 5th, 2020, 04:04 AM
#1
Thread Starter
Fanatic Member
Outlook - How to verify if a distribution list exist
Hi,
I need to find method to verify if a mail group/distribution list exist in Outlook addresslist.
so far... I am no where and just started to import the Outlook interrupt library. I am trying to get the content of "Microsoft.Office.Interop.Outlook.ExchangeDistributionList" to see that brings me some insight.
Any help is appreciated.
Thanks.
-
Nov 5th, 2020, 04:39 AM
#2
Re: Outlook - How to verify if a distribution list exist
you can try like
Code:
Set mycontacts = Session.GetDefaultFolder(olFolderContacts)
For Each itm In mycontacts.Items
If TypeName(itm) = "DistListItem" Then MsgBox "one or more distribution list exists"
Next
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 5th, 2020, 04:45 AM
#3
Thread Starter
Fanatic Member
Re: Outlook - How to verify if a distribution list exist
Thanks.
Is there any alternative to "Set"? My code editor says it is no longer supported.
I tried Dim mycontacts As Object = Session.GetDefaultFolder(olFolderContacts)
but now both "Session" and "olFolderContacts" are red-underlined
-
Nov 5th, 2020, 05:43 AM
#4
Re: Outlook - How to verify if a distribution list exist
just omit the set keyword
but now both "Session" and "olFolderContacts" are red-underlined
as you are working from .net, you should use your outlook introp object something like
Code:
mycontacts = objolook.Session.GetDefaultFolder(olFolderContacts)
olFolderContacts is an outlook constant, it should also be in your interop items, else its literal value is 10
i have never tried programming outlook from vb.net, so can not give exact example
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|