
Create New Contact in Public Folder
I am currently trying to have my Access database run code
to create a Contact Item in a Public Folder (Address Book)
so that all my users can access this information. What is
happening is that the contact item is being created in my
Contacts address book, not the Advisor Contacts address
book. I have attached the code. Can anyone tell me where
I'm going wrong?
Thanks!
Melissa Lamprecht
Code Follows:
Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim cf As Outlook.MAPIFolder
Dim cf1 As Outlook.MAPIFolder
Dim cf2 As Outlook.MAPIFolder
Dim c As Outlook.ContactItem
Dim Prop As Outlook.UserProperty
Set olns = ol.GetNamespace("MAPI")
Set cf1 = olns.Folders("Public Folders")
Set cf2 = cf1.Folders("All Public Folders")
Set cf = cf2.Folders("Advisor Contacts")
Set c = ol.CreateItem(olContactItem)
c.MessageClass = "IPM.Contact.AdvisorContacts" 'Custom
Form Showing Customer ID
c.CompanyName = firm
c.FullName = advfirst & " " & advlast
c.BusinessAddressStreet = addr1
c.BusinessAddressCity = cty
c.BusinessAddressState = st
c.BusinessAddressPostalCode = zp
c.BusinessTelephoneNumber = ph
c.Email1Address = eml
c.Email1AddressType = "SMTP"
c.Email1DisplayName = display
c.CustomerID = alias
c.Save
c.Close olSave