Solved

Outlook Contact Form

Posted on 2011-02-15
6
283 Views
Last Modified: 2013-11-05
Does anyone know how to load the Outlook Contact Form which has all the contacts information based on the contacts EntryID in vb6.

Any help would be appreciated.
0
Comment
Question by:PhilChapmanJr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 34906929
Hi, PhilChapmanJr.

Sorry, I don't understand what you mean.  Can you explain?
0
 
LVL 2

Author Comment

by:PhilChapmanJr
ID: 34907169
I can load the contacts by using the code below.

The objItem.EntryID is the actual contacts Outlook ID number

I'm storing the objItem.EntryID as a key in the ListView

What I need to do is dbl-clieck on the desired ListView item and

Get the correct objItem and then do a
objItem.Display
Which will pull up the Outlook Contact Form.



Private Sub Command1_Click()

Dim strTemp As String
Dim RecCount As Long


Dim lngLoop As Long
On Error GoTo Main_Error
 
Set objApp = New Outlook.Application
Set objNS = objApp.GetNamespace("MAPI")
Set colAdressFolders = New Collection
Set objFolder = objNS.Folders.GetFirst ' get root-folder

For lngLoop = 1 To objFolder.Folders.Count
    If objFolder.Folders.Item(lngLoop).DefaultItemType = olContactItem Then
        RecursiveSearch objFolder.Folders.Item(lngLoop), colAdressFolders
    End If
Next lngLoop

ListView.ListItems.Clear
LockWindowUpdate ListView.hWnd

RecCount = 0
For Each objFolder In colAdressFolders
    For lngLoop = 1 To objFolder.Items.Count
        Set objItem = objFolder.Items(lngLoop)
        Set itmX = ListView.ListItems.Add(, "K" & objItem.EntryID, objItem.EntryID)
       
        itmX.SubItems(1) = objItem.CompanyName
        itmX.SubItems(2) = objItem.FullName
        itmX.SubItems(3) = ""
    Next
Next
On Error GoTo 0
LockWindowUpdate 0
Exit Sub
 
Main_Error:
   
    MsgBox "Error " & Err.Number & " (" & Err.Description & ")" & objItem.FullName
    Resume Next
End Sub


Private Sub RecursiveSearch(objSubFolder As Outlook.MAPIFolder, colAdrFolders As Collection)
 
Dim lngLoop As Long


If objSubFolder.Items.Count > 0 Then
    'add reference to collection
    colAdrFolders.Add objSubFolder
    cmbAddressBooks.AddItem objSubFolder
End If
 
If objSubFolder.Folders.Count > 0 Then
    For lngLoop = 1 To objSubFolder.Folders.Count
        If objFolder.Folders.Item(lngLoop).DefaultItemType = olContactItem Then
            RecursiveSearch objSubFolder.Folders.Item(lngLoop), colAdrFolders
        End If
    Next lngLoop
End If
If cmbAddressBooks.ListCount > 0 Then cmbAddressBooks.ListIndex = 0
Exit Sub
Errorhandler:
MsgBox "An unexpected error occured methode RECURSIVESEARCH", vbCritical + vbOKOnly, "Problem"
Err.Clear

On Error GoTo 0
Exit Sub
   
RecursiveSearch_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure RecursiveSearch of Module modOutlook"
End Sub
 
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 34907280
Got it.  That's simple.
Set olkContact = objNS.GetItemFromID(the_entry_id_of_the_Item_from_your_listview)
olkContact.Display

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:PhilChapmanJr
ID: 34907474
Works Great!

Thanks
0
 
LVL 2

Author Closing Comment

by:PhilChapmanJr
ID: 34907480
Thanks
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34907586
You're welcome!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month7 days, 9 hours left to enroll

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question