HELP!!! Creating Contacts on Public Folders 
Author Message
 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



Sun, 29 Jun 2003 05:10:25 GMT  
 HELP!!! Creating Contacts on Public Folders
Once you have the public folder you want, use the Add method on the
Items collection for that folder.

Set conOutLook = myFolder5.Items.Add

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Co-author of "Programming Microsoft Outlook 2000", Chapters 8-13,
Appendices, Sams


Quote:
> 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



Sun, 29 Jun 2003 05:40:37 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Create New Contact in Public Folder

2. Creating Contacts in a Public Folder

3. How to create a contact in a Public Folder with VBA

4. Public Folder Contact folders.

5. Syncronize in programmatic way, the folder Contact with the public folder

6. Email address from a public contact folder - PLEASE HELP

7. How do I add a contact to a public folder programatically

8. Resolve Contact to Public Folder

9. Need sample code for read public folder contact into access

10. Enable a Public folder (contacts) for Outlook address Book

11. Referring to Items in Public (Contacts) Folder

12. Synchronizing/exporting contacts into Public Folder

 

 
Powered by phpBB® Forum Software