Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Outlook Contact Form

Posted on 2011-02-15
6
Medium Priority
?
285 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

660 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