Distribution lists in shared mailboxes

N

nialllinden

I was wondering if anyone could help with this problem. Basically I
wish to be able to automatically send a file (created in VB) to a mail
recipient (pretty easy using an oulook object)

But the problem is a bit more complicated. The mail should be sent to
a distribution list. And this distrubtion list in in a shared mailbox.

There is a shared mailbox - Dublin Mailbox. When I look in 'My
Conracts' I see a list of contacts ie

Anna in Mailbox - Dublin Mailbox
Niall in Mailbox - Dublin MAilbox
John in Mailbox - Dublin mailbox

When I click on any of these contacts I see a set of distribution
lists. Perhaps 20 in each contacts.

Now currently the only way to send a mail to one of these lists is to
go to the my contacts, click on the contact, then right click on the
distributionlist and select send new mail to contact

If i open a new message I cannot get any of the distrubtion lists to
appear as they are all in a shared mailbox and as from other posts
these dont appear in your address book and it is quite comlicated to
get them to appear

What I was wondering if I know the name of the mailbox is it possible
via vba to open or get a handel to the mailbox, then get a handle to
the contacts in this mailbox and from that the distribution lists that
are int he contacts. (potentially get a list of these that the user
could slect from a drop down combo box). This could then be used to
create the mail to the distribution list and attach the appropriate
file.

Is this possible

Niall
 
N

nialllinden

I actually found code that did what I wanted

Public Sub GetOutlookFolderID()
'Dim x As Variant
Dim y As Variant
Dim z As Variant
Dim x As Outlook.DistListItem
Dim olfolder As Outlook.MAPIFolder
Dim olapp As Outlook.Application
Set olapp = CreateObject("Outlook.Application")
Set olfolder = olapp.GetNamespace("MAPI").Folders.Item("Mailbox -
Dublin Mailbox").Folders.Item("Contacts").Folders.Item("Anna")
For Each x In olfolder.Items
Debug.Print x

For y = 1 To x.MemberCount
z = x.GetMember(y).Address
Debug.Print z

Next
Debug.Print ""
Next
' olfolder.Display
' Debug.Print olfolder.EntryID
Set olfolder = Nothing
Set olapp = Nothing
End Sub

this prints out all the distribution lists in the Anna folder, and the
email addresses in them. Excuse the use variants as it was just proof
of concept bit of code and changed a few times

Maybe this will help someone else
 

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