<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=972521208-30042003><FONT face=Arial color=#0000ff
size=2>Fantastic! So is this a straight MAPI call, & how did you know how to
do it...? </FONT></SPAN></DIV>
<DIV><SPAN class=972521208-30042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=972521208-30042003></SPAN> </DIV>
<DIV></DIV>
<DIV><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Drew
Wutka [mailto:DWUTKA@marlow.com] <BR><B>Sent:</B> 29 April 2003
19:41<BR><B>To:</B> 'accessd@databaseadvisors.com'<BR><B>Subject:</B> RE:
[AccessD] Picking up Outlook address data etc.<BR><BR></DIV></FONT>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff size=2>Okay
friend for life! <grin></FONT></SPAN></DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff size=2>I
put this code behind a command button on a VB form with a Listbox
(List1):</FONT></SPAN></DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2>Private Sub Command1_Click()<BR>On Error Resume Next<BR>Dim mps As
MAPI.Session<BR>Dim al As MAPI.AddressList<BR>Dim ae As
MAPI.AddressEntry<BR>Dim fld As Field<BR>Dim strTemp As String<BR>Set mps =
CreateObject("MAPI.Session")<BR>mps.Logon , , , , , , "Main2.marlow.com" &
vbLf & "Drew Wutka"<BR>Set al = mps.GetAddressList(0)<BR>For Each ae In
al.AddressEntries<BR> strTemp =
ae.Name<BR> For Each fld In
ae.Fields<BR> If InStr(1, fld.Value,
"@") > 0 Then strTemp = strTemp & " - " &
fld.Value<BR> Next<BR> Me.List1.AddItem
strTemp<BR>Next</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff size=2>Set
ae = Nothing<BR>Set al = Nothing<BR>mps.Logoff<BR>Set mps = Nothing<BR>End
Sub</FONT></SPAN></DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff size=2>Of
course, you'll need to change the mps.Logon line, because it is logging into
my email (and it only does so because it uses the credentials of my current
logged on account.</FONT></SPAN></DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff size=2>But
this code fills the listbox with every name (and their addressES) in the
Global Address List.</FONT></SPAN></DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff size=2>I
must admit, I have never done this before...never needed to, so if you have a
more specific question, I'll have to research it a bit.</FONT></SPAN></DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=830043918-29042003><FONT face=Arial color=#0000ff
size=2>Drew</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Roz Clarke
[mailto:roz.clarke@donnslaw.co.uk]<BR><B>Sent:</B> Tuesday, April 29, 2003
3:09 AM<BR><B>To:</B> 'accessd@databaseadvisors.com'<BR><B>Subject:</B> RE:
[AccessD] Picking up Outlook address data etc.<BR><BR></FONT></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff size=2>Hi
Drew</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Thanks for the offer of help.</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>After reading around on CDO, ADSI etc I had a quick go just using the
Outlook object library and got this far:</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Sub getGAL_click()</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>'this code based on MSKB article 313797<BR>'tweaked by
rozc</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Dim oApp As Outlook.Application<BR>Set oApp = New
Outlook.Application</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Dim oNS As Outlook.NameSpace<BR>Set oNS =
oApp.GetNamespace("mapi")</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>'oNS.Logon "rozc", "avalon", False, True<BR>'logon information does
not seem to be required if you are happy to use<BR>'the current session
profile.</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Dim oDLs As Outlook.AddressLists<BR>Set oDLs =
oNS.AddressLists</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Dim oGAL As Outlook.AddressList<BR>Set oGAL = oDLs.Item("Global
Address List")</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Dim oEntries As Outlook.AddressEntries<BR>Set oEntries =
oGAL.AddressEntries</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Dim oEntry As Outlook.AddressEntry</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Dim i As Integer</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>For i = 1 To oEntries.Count<BR> Set oEntry =
oEntries.Item(i)<BR> Debug.Print
oEntry.Name<BR>Next</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>'oNS.Logoff</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>End Sub</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>This gets me a list of the correct names in the global address list.
Unfortunately the address attribute available here is a path to a mailbox,
not an email address - which I have't tried using for anything but I don't
imagine it would be much use.</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff size=2>I
also haven't tried using the Name as the recipient but I'm hoping that
Outlook will be able to resolve it. So, I maybe almost have something that
will work!</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Where I got stuck with the CDO was in referencing the GAL - all the
sample code & Exchange viewers I could find got me into every other
folder but. If you can provide me with that, I'll be your friend for life
:)</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>TIA</FONT></SPAN></DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=020310308-29042003><FONT face=Arial color=#0000ff
size=2>Roz</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Drew Wutka
[mailto:DWUTKA@marlow.com] <BR><B>Sent:</B> 29 April 2003
01:04<BR><B>To:</B> 'accessd@databaseadvisors.com'<BR><B>Subject:</B> RE:
[AccessD] Picking up Outlook address data etc.<BR><BR></FONT></DIV>
<DIV><SPAN class=178240200-29042003><FONT face=Arial color=#0000ff
size=2>Yes, CDO is free. It's behind MAPI, which is a pain. I
personally find CDO pretty easy to use.</FONT></SPAN></DIV>
<DIV><SPAN class=178240200-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=178240200-29042003><FONT face=Arial color=#0000ff
size=2>Unless everyone wants me to clutter the list with sample code, if
you email me offline Roz, I can probably send what you are going to need
piece meal.</FONT></SPAN></DIV>
<DIV><SPAN class=178240200-29042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=178240200-29042003><FONT face=Arial color=#0000ff
size=2>Drew</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Roz Clarke
[mailto:roz.clarke@donnslaw.co.uk]<BR><B>Sent:</B> Monday, April 28,
2003 9:22 AM<BR><B>To:</B>
'accessd@databaseadvisors.com'<BR><B>Subject:</B> [AccessD] Picking up
Outlook address data etc.<BR><BR></FONT></DIV>
<P><FONT face=Arial size=2>Dear List</FONT> </P>
<P><FONT face=Arial size=2>Does anyone have the low-down on how to get
data out of Exchange? We're running Exchange 2000 with Office XP.</FONT>
</P>
<P><FONT face=Arial size=2>What I need to be able to do is
</FONT><BR><FONT face=Arial size=2>a) automatically mail certain
pre-defined staff members at certain times (singly and in groups),
and</FONT> <BR><FONT face=Arial size=2>b) allow people to send ad-hoc
mails from the database, selecting from a list of staff members or
typing in mail addresses.</FONT></P>
<P><FONT face=Arial size=2>Currently we are entering all email addresses
manually for the ad-hoc mails and relying on a local table of mail
addresses for the automated mails - a ridiculous duplication of effort
when all this stuff is on the system already.</FONT></P>
<P><FONT face=Arial size=2>So.... All I've managed to find on MSDN are
some references to something called CDO which can be used to extend
Exchange (though it's not wonderfully clear in what ways), but I can't
see how to get it and unless it's free I can't have it
anyway.</FONT></P>
<P><FONT face=Arial size=2>Can anyone help?</FONT> </P>
<P><FONT face=Arial size=2>TIA</FONT> </P>
<P><FONT face=Arial size=2>Roz</FONT>
</P></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>