John Ruff
papparuff at attbi.com
Wed May 7 20:14:23 CDT 2003
Stuart,
I was able to link to my Contacts folder and see the email addresses with no
problems so I'm not sure why you can't see yours. However, you can also use
Automation to get the addresses:
Public Function GetContact(Optional strName As String) As String
Dim objOlApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim strFullName As String
Dim strEmail As String
Dim objContact As Outlook.ContactItem
Dim i As Integer
Set objOlApp = CreateObject("Outlook.Application")
Set objNameSpace = objOlApp.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objItems = objFolder.Items
If strName = "" Then
' This prints all the contacts in the contacts list
For i = 1 To objItems.Count
On Error Resume Next
Debug.Print objItems.Item(i).FullName
Debug.Print objItems.Item(i).Email1Address
Next i
Err = 0
Else
' This prints the info for a specific contact
With objFolder.Items(strName)
strFullName = .FullName
strEmail = .Email1Address
End With
GetContact = strFullName & "\" & strEmail
End If
Set objItems = Nothing
Set objFolder = Nothing
Set objNameSpace = Nothing
Set objOlApp = Nothing
End Function
John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities
Home: 253.588.2139
Cell: 253.307/2947
9306 Farwest Dr SW
Lakewood, WA 98498
"Commit to the Lord whatever you do,
and your plans will succeed." Proverbs 16:3
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Wednesday, May 07, 2003 5:34 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Getting Email from Linked Outlook Contacts
I want to set up an automated mailing process in A2K for someone using
Oulook 2K.
Simple enough, I thought, I know you can link to Outlook folders so, I will
just link to his Contacts, then iterate through
them and pick the email addresses.
Linked to Contacts and went looking - lo and behold - no email address
fields in the linked Contacts :-(
I know I could use use Docmd.SendObject,,,,"Display Name (E-mail)"..........
but I don't want to send the messages through Outlook/Exchange.
For various reasons, I want to grab the email address and BLAT the message
out.
If I export Contacts to an Access database, the fields I want are in the
exported table, but when I link to Contacts they
are not :-(
Anyone know how I can get the email address(es) from the Outlook Contacts
folder live (ie by linking, not
exporting/importing)?
--
Stuart McLachlan
Lexacorp Ltd
Application Development, IT Consultancy http://www.lexacorp.com.pg
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com