C
Charlie
Here is the beginning of some code I'm using:
' Set up DAO objects (uses existing "Contacts" table)
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Outlook Contacts")
' Set up Outlook objects.
Dim ol As New Outlook.Application
Dim olns As Outlook.Namespace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.ContactItem
Dim objItems As Outlook.Items
Dim Prop As Outlook.UserProperty
Set olns = ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderContacts)
Set objItems = cf.Items
iNumContacts = objItems.Count
If iNumContacts <> 0 Then
For I = 1 To iNumContacts
If TypeName(objItems(I)) = "ContactItem" Then
Set c = objItems(I)
If c.Categories = strCategory Then 'It's one of the right category
My question is which part of this do I need to change if I want to access
contacts in a different folder? In Outlook, I have a folder called Work
Contacts, it's not a sub folder to "Contacts" it's just another folder in the
list where it says Contacts, Inbox, Outbox, etc... I'd like to access these
contact items directly, rather than having to always move them to my regular
Contact folder to access them.
thanks,
ck
' Set up DAO objects (uses existing "Contacts" table)
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Outlook Contacts")
' Set up Outlook objects.
Dim ol As New Outlook.Application
Dim olns As Outlook.Namespace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.ContactItem
Dim objItems As Outlook.Items
Dim Prop As Outlook.UserProperty
Set olns = ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderContacts)
Set objItems = cf.Items
iNumContacts = objItems.Count
If iNumContacts <> 0 Then
For I = 1 To iNumContacts
If TypeName(objItems(I)) = "ContactItem" Then
Set c = objItems(I)
If c.Categories = strCategory Then 'It's one of the right category
My question is which part of this do I need to change if I want to access
contacts in a different folder? In Outlook, I have a folder called Work
Contacts, it's not a sub folder to "Contacts" it's just another folder in the
list where it says Contacts, Inbox, Outbox, etc... I'd like to access these
contact items directly, rather than having to always move them to my regular
Contact folder to access them.
thanks,
ck