
HELP!!! Creating Contacts on Public Folders
I am very inexperienced with the OUTLOOK Object Model. I am trying to
create a contact on a public folder (Service Delivery Managers) several
layers under the "Public Folders" within OUTLOOK. I have been successful in
creating this contact to my own contact folder. Below is my code, I can't
seem to put it together in order to create this contact to the Public Folder
as shown my the "myFolder5" variable. Could someone help me put this
together. I am most greatful for help in solving this.
Thanks
TA
Sub AddContactToOutlook()
On Error GoTo ErrorHandling_Err
Dim appOutLook As Outlook.Application
Dim conOutLook As Outlook.ContactItem
Dim myFolder1 As MAPIFolder
Dim myFolder2 As MAPIFolder
Dim myFolder3 As MAPIFolder
Dim myFolder4 As MAPIFolder
Dim myFolder5 As MAPIFolder
Dim onMAPI As NameSpace
Set appOutLook = CreateObject("Outlook.Application")
Set onMAPI = appOutLook.GetNamespace("MAPI")
Set myFolder1 = onMAPI.Folders("Public Folders")
Set myFolder2 = myFolder1.Folders("All Public Folders")
Set myFolder3 = myFolder2.Folders("Concert Organizations")
Set myFolder4 = myFolder3.Folders("N&S Delivery")
Set myFolder5 = myFolder4.Folders("Service Delivery Managers")
Set conOutLook = appOutLook.CreateItem(olContactItem)
With myFolder5.conOutLook
.FirstName = "Tom"
.LastName = "Smith"
.BusinessTelephoneNumber = "(808)555-5555"
.Birthday = "12/31/1970"
.CompanyName = "FSSG"
.JobTitle = "Software Engineer"
.ManagerName = "Rob Kohler"
.Save
End With
Set conOutLook = Nothing
Set appOutLook = Nothing
ErrorHandling_Err:
If Err Then
End If
End Sub