Error using AddressEntry.GetContact - need help

Status
Not open for further replies.

SmileyFtW

Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
I am trying to do some automation on distribution lists, but am running into a snag. In a distribution list the GetMember method returns a Recipient object which has a limited amount of information and I want to get the Contact object represented by the Recipient. I test to make sure the recipient is resolved, but when I attempt to use the AddressEntry.GetContact method I get a run time error. What am I doing wrong or what else do I need to do?

Set myNameSpace = Application.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
Set myFolderItems = myFolder.Items
iCount = myFolderItems.Count
For x = 1 To iCount
If TypeName(myFolderItems.Item(x)) = "DistListItem" Then
Set myDistList = myFolderItems.Item(x)
For y = 1 To myDistList.MemberCount
Set myRecipient = myDistList.GetMember(y)
RecipientIsResolved = myRecipient.Resolved
If RecipientIsResolved = True Then
Set myAddressEntry = myRecipient.AddressEntry
Set myContactItem = myAddressEntry.GetContact '<Errors here with "The item could not be found"
With myContactItem
'Here I would be able to access all of the contact's information
End With
End If

Debug.Print myDistList.GetMember(y).Name
' If myDistList.GetMember(y).Name = myNameSpace.CurrentUser.Name Then
' MsgBox "Your are a member of " & myDistList.DLName
' End If
Next y
End If
Next x

Thanks!
David
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I could never figure when that function works and when it doesn´t. I´d use the Items.Find function of the contacts folder and search the email address myself.
 

SmileyFtW

Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
I actually came at the problem from a different angle and got what I needed. I used the Restrict method on the contacts folder and then looped the restricted contact items. The Outlook object model is so convoluted compared to the Excel OM.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
S Autosave attachments error using Len Outlook VBA and Custom Forms 2
B 0x800CCC0F Error using POP3 in Outlook 2010 and 2013 Using Outlook 1
H Send/Receive Error Sending E-Mails Using POP3 GMail Account Using Outlook 2
C Error message when trying to send email using a distribution list Using Outlook 2
J Run time error when using unbound fields in form Using Outlook 1
J After Window update of 12/15/2010, outlook 2007 gives error (0x800CCC18) when accessing gmail using Using Outlook 6
D Re: Error 5009 when using scheduling assistant for a meeting Using Outlook 1
G Script Error message when trying to print e-mails using Outlook Mail Using Outlook 2
R Error when synchronizing using Outlook Using Outlook 7
S I am using Outlook 2007, getting an error 0X8007000E "Out of Memory or system resources". C Using Outlook 1
G Error code 0x8004210a - using Outlook 2003 Using Outlook 2
K ERROR 80041050 AND 8004102A WHEN USING OUTLOOK 2010 Using Outlook 4
S When using the new junk email reporting tool for Outlook 2010 I get a error reporting tool could not Using Outlook 13
W Using secondary account recieve error message that 'The sent items folder is unavailable.' Using Outlook 2
F Error message 0x80004002 using Outlook 2010 with XP on Comcast IP Using Outlook 4
R Initial sign-in error using Hotmail Connector. Using Outlook 2
T Using Office 2003 Outlook for email: Error, E-mail client not configured Using Outlook 1
D Error 0x80048002 while using Outlook2010 x86 or x64 with Exchange 2003 in cache mode Using Outlook 1
A Error Number: 0x800CCC69 Sending emails using Outlook Express Using Outlook 1
D Using the POP 3 forwarding from Gmail to outlook I can receive mail into outlook but get a sending error Outgoing SMTP does not support SSL secured Using Outlook 2
A Synchronization Error of contacts and calender using Outlook connector Using Outlook.com accounts in Outlook 12
A Error: 3033 when trying to OpenDatabase using DAO Outlook VBA and Custom Forms 3
S Outlook 2007 error message using the TASK feature Using Outlook 6
V Date and/or time error in Outlook Form Outlook VBA and Custom Forms 0
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
E Complite error on SaveAsFile method Outlook VBA and Custom Forms 3
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
D Outlook VBA error extracting property data from GetRules collection Outlook VBA and Custom Forms 10
A Unable to save recurring Meeting to Documents folder due to error Using Outlook 2
M Compile error: User-defined type not defined Outlook VBA and Custom Forms 0
R Error when trying to forward current email item Outlook VBA and Custom Forms 7
M ERROR: None of your email accounts could send to this recipient Using Outlook 2
J OLADD.FAE Error When Exporting Contacts Using Outlook 6
C Send/receive error 80040119 Using Outlook 2
W error with the permission for the file Outlook VBA and Custom Forms 0
L Outlook 2019 MAC sync error after working for 4 hours Using Outlook 1
A Run time error 424. object required in outlook 2013 Outlook VBA and Custom Forms 10
M error code 0x8DE00006 Using Outlook 1
M Desktop Version Of Outlook Generating Error Using Outlook 4
M Send/Receive error 0x800CCC0F Using Outlook 0
T Outlook 2016 CSV Translator Import Error Using Outlook 6
ManaarZakaria I'm afraid of this issue, cause of strange error Exchange Server Administration 2
P Suppress dialog box on email check error? Using Outlook 5
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
avant-guvnor Outlook.Application now produces error Outlook VBA and Custom Forms 5
P Run Time Error 91 when linking contact to task in VBA Outlook VBA and Custom Forms 1
N Error 0x80090326 when trying to setup IMAP account on Outlook.com Using Outlook.com accounts in Outlook 1
N Saving And Deleting Outlook Attachments with Unknown Error Message Outlook VBA and Custom Forms 1
Dennis Gaudenzi Your setup couldn't be started because of an unexpected error (mapi 0x80040604) Using Outlook 14
Similar threads


















































Top