Hello All,
So I have been Google-ling for round about a day now, and I just don't know how to accomplish this task.
Here is the Scenario, I have two text field boxes - FIRSTNAME and LASTNAME which I type a first and last name into, and then the Global Address Book is checked, I then am hoping for 1 of 3 things.
1. That name will be checked to see if it is in the address book, if it is something happens.
2. A drop down list with all available names that match that is show and I can select that in doing so will then replace the names I typed with the outlook first and last name.
3. The actual Address book window opens where I can search for a name, and then clicking on it will populate the first and last names of the two text boxes.
Any help on this would be greatly appreciated.
I did look at some MS info, and the closes thing I could get is below the issue is that it gives an error when trying to search which I don't understand.
I have Referenced Microsoft Office 14.0 Object Library, and Microsoft Outlook 14.0 Object Library.
The Error that shows up is:
A first chance exception of type 'System.NullReferenceException' occurred in ConsoleApplication1.exe
Imports Microsoft.Office.Interop
Imports System.Reflection
Module Module1
Sub Main()
Dim oApp As Outlook.Application = New Outlook.Application()
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNS.Logon("Outlook", Missing.Value, False, True)
Dim cContacts As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
Dim oItems As Outlook.Items = cContacts.Items
Dim oCt As Outlook.ContactItem
Try
oCt = oItems.Find("[Last Name] = 'stenzel'")
Console.WriteLine(oCt.FullName)
Console.WriteLine(oCt.Title)
Console.WriteLine(oCt.Birthday)
Console.WriteLine(oCt.CompanyName)
Console.WriteLine(oCt.Department)
Console.WriteLine(oCt.Body)
Console.WriteLine(oCt.FileAs)
Console.WriteLine(oCt.Email1Address)
Console.WriteLine(oCt.BusinessHomePage)
Console.WriteLine(oCt.MailingAddress)
Console.WriteLine(oCt.BusinessAddress)
Console.WriteLine(oCt.OfficeLocation)
Console.WriteLine(oCt.Subject)
Console.WriteLine(oCt.JobTitle)
Catch
Console.WriteLine("an error occurred")
Finally
oNS.Logoff()
oApp = Nothing
oNS = Nothing
oItems = Nothing
oCt = Nothing
End Try
End Sub
End Module