C
Clive Godden
Ime trying to create Outlook contacts in a sub folder of Personal Folders, I
can create the folder Ok if it doesnt exist
but it only adds the contacts to the proper contacts folder, How do I set
the folder to be the sub folder for the contacts to be added to ??
Heres my code (please dont laugh ime a newbie)
Dim oApp As Outlook.Application = New Outlook.Application
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
Dim objFolder As Outlook.MAPIFolder = oNS.Folders.Item("Personal
Folders").Folders.Item("Project Contacts")
If objFolder Is Nothing Then
oNS.Folders.Item("Personal Folders").Folders.Add("Project Contacts")
End If
objFolder = oNS.Folders.Item("Personal Folders").Folders.Item("Project
Contacts")
Dim urgentfolder = oNS.Folders("Personal folders").Folders
Dim MyItem = urgentfolder("Project
Contacts").Items.Add(Outlook.OlItemType.olContactItem)
With MyItem
.Email1Address = em
.Email1DisplayName = en
.FullName = fn
.CompanyName = cn
.JobTitle = jt
.BusinessAddressCity = bac
.BusinessAddressCountry = cntry
.Email1AddressType = "SMTP"
.Save()
End With
can create the folder Ok if it doesnt exist
but it only adds the contacts to the proper contacts folder, How do I set
the folder to be the sub folder for the contacts to be added to ??
Heres my code (please dont laugh ime a newbie)
Dim oApp As Outlook.Application = New Outlook.Application
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
Dim objFolder As Outlook.MAPIFolder = oNS.Folders.Item("Personal
Folders").Folders.Item("Project Contacts")
If objFolder Is Nothing Then
oNS.Folders.Item("Personal Folders").Folders.Add("Project Contacts")
End If
objFolder = oNS.Folders.Item("Personal Folders").Folders.Item("Project
Contacts")
Dim urgentfolder = oNS.Folders("Personal folders").Folders
Dim MyItem = urgentfolder("Project
Contacts").Items.Add(Outlook.OlItemType.olContactItem)
With MyItem
.Email1Address = em
.Email1DisplayName = en
.FullName = fn
.CompanyName = cn
.JobTitle = jt
.BusinessAddressCity = bac
.BusinessAddressCountry = cntry
.Email1AddressType = "SMTP"
.Save()
End With