PC Review


Reply
Thread Tools Rate Thread

get contactitem from addressentry

 
 
sd
Guest
Posts: n/a
 
      25th Jun 2008
hello
I need to display AddressBook for OL 2003 ,OL 2007 & let the user
select the entries listed in addressbook.From the
selected entry I need to retrive the contactItem & retrieve its
properties(ENtryID,Phone numbers etc.)
I'm using below code -
Dim objMAPIUtils As Redemption.MAPIUtils 'Object
Dim objRecipients As Redemption.SafeRecipients
Dim objRecipient As Redemption.SafeRecipient
Dim ObjContact As Outlook.ContactItem
objMAPIUtils = CreateObject("Redemption.MAPIUtils")
objRecipients = objMAPIUtils.AddressBook(, "Address Book",
False, False, 1, "&To", "&Cc", "&Bcc")
If objRecipients.Count > 0 Then
For Each objRecipient In objRecipients
' get contactitem from ObjRecepient & retrieve its
EntryID
Next
If Not objRecipients Is Nothing Then objRecipients = Nothing
If Not objMAPIUtils Is Nothing Then objMAPIUtils = Nothing
How to get the contactitem & retrive its EntryID.For OL 2007 I can get
contact in OL 2007 by addentry.GetContact
But for OL2003 I'm not able to get contactitem.
Thanks
-sd
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      25th Jun 2008
You can use Redemption to do what you want in a way that won't depend on
using the Outlook 2007 object model.

Use RDOSession and get session.AddressBook.ShowAddressBook() to get back an
RDORecipients collection. Iterate that collection and for each RDORecipient
use its AddressEntry.GetContact() method to retrieve the contact as an
RDOContactItem. You can use the RDOContactItem then or get its EntryID if
you want to retrieve the corresponding Outlook.ContactItem.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"sd" <(E-Mail Removed)> wrote in message
news:855fdedb-17d8-4342-83f6-(E-Mail Removed)...
> hello
> I need to display AddressBook for OL 2003 ,OL 2007 & let the user
> select the entries listed in addressbook.From the
> selected entry I need to retrive the contactItem & retrieve its
> properties(ENtryID,Phone numbers etc.)
> I'm using below code -
> Dim objMAPIUtils As Redemption.MAPIUtils 'Object
> Dim objRecipients As Redemption.SafeRecipients
> Dim objRecipient As Redemption.SafeRecipient
> Dim ObjContact As Outlook.ContactItem
> objMAPIUtils = CreateObject("Redemption.MAPIUtils")
> objRecipients = objMAPIUtils.AddressBook(, "Address Book",
> False, False, 1, "&To", "&Cc", "&Bcc")
> If objRecipients.Count > 0 Then
> For Each objRecipient In objRecipients
> ' get contactitem from ObjRecepient & retrieve its
> EntryID
> Next
> If Not objRecipients Is Nothing Then objRecipients = Nothing
> If Not objMAPIUtils Is Nothing Then objMAPIUtils = Nothing
> How to get the contactitem & retrive its EntryID.For OL 2007 I can get
> contact in OL 2007 by addentry.GetContact
> But for OL2003 I'm not able to get contactitem.
> Thanks
> -sd


 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      26th Jun 2008
Do not use MAPIUtils for that (this is an old obejct used for compatibility
purposes).
Use RDOSession, and RDOSession.AddressBook.ShowAddressBook in particular. to
display the address book dialog.
You can then retrieve the contact using RDOAddressEntry.GetContact (get back
RDOContactItem object).

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"sd" <(E-Mail Removed)> wrote in message
news:855fdedb-17d8-4342-83f6-(E-Mail Removed)...
> hello
> I need to display AddressBook for OL 2003 ,OL 2007 & let the user
> select the entries listed in addressbook.From the
> selected entry I need to retrive the contactItem & retrieve its
> properties(ENtryID,Phone numbers etc.)
> I'm using below code -
> Dim objMAPIUtils As Redemption.MAPIUtils 'Object
> Dim objRecipients As Redemption.SafeRecipients
> Dim objRecipient As Redemption.SafeRecipient
> Dim ObjContact As Outlook.ContactItem
> objMAPIUtils = CreateObject("Redemption.MAPIUtils")
> objRecipients = objMAPIUtils.AddressBook(, "Address Book",
> False, False, 1, "&To", "&Cc", "&Bcc")
> If objRecipients.Count > 0 Then
> For Each objRecipient In objRecipients
> ' get contactitem from ObjRecepient & retrieve its
> EntryID
> Next
> If Not objRecipients Is Nothing Then objRecipients = Nothing
> If Not objMAPIUtils Is Nothing Then objMAPIUtils = Nothing
> How to get the contactitem & retrive its EntryID.For OL 2007 I can get
> contact in OL 2007 by addentry.GetContact
> But for OL2003 I'm not able to get contactitem.
> Thanks
> -sd



 
Reply With Quote
 
sd
Guest
Posts: n/a
 
      26th Jun 2008
Thanks Ken & Dimitry!!
-sd
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting an AddressEntry by Name =?Utf-8?B?UmE=?= Microsoft Outlook Interoperability 2 14th May 2007 08:38 PM
ContactItem vs AddressEntry miaplacidus Microsoft Outlook Contacts 3 8th Jul 2004 10:40 PM
Which way should I add an AddressEntry? Shelby Microsoft Outlook VBA Programming 3 15th Jun 2004 03:32 PM
CDO 1.21 AddressEntry.Fields =?Utf-8?B?TWlrZQ==?= Microsoft C# .NET 3 13th Apr 2004 03:01 PM
how to use Email1EntryID to get AddressEntry Hendrik Schreiber Microsoft Outlook VBA Programming 3 10th Sep 2003 09:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:55 PM.