PC Review


Reply
Thread Tools Rate Thread

Accessing contacts in a different folder called "Work Contacts"

 
 
=?Utf-8?B?Q2hhcmxpZQ==?=
Guest
Posts: n/a
 
      29th Apr 2006
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
 
Reply With Quote
 
 
 
 
John Nurick
Guest
Posts: n/a
 
      30th Apr 2006
Hi Charlie,

This is an Outlook question rather than an Access one. A good place to
look is www.outlookcode.com


On Sat, 29 Apr 2006 14:57:01 -0700, Charlie
<(E-Mail Removed)> wrote:

>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


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sending previous "contacts" to new "contacts" folder Gary VanderMolen \(MVP\) Windows Vista Mail 8 25th Nov 2009 04:45 PM
Imprt Contacts Problem "select destination folder" window not work =?Utf-8?B?U3Blc2g=?= Microsoft Outlook Contacts 3 23rd Jan 2007 02:50 AM
Making contacts in public folder the default for "New Contacts"? =?Utf-8?B?SmFydnN0ZXI=?= Microsoft Outlook Contacts 1 27th Jan 2006 03:53 PM
Import Categories from "Contacts in Personal Folder" to "Contacts" =?Utf-8?B?QmV2IFJlZWQ=?= Microsoft Outlook Contacts 0 22nd Feb 2005 06:13 PM
Changing the name of the "Business Contacts" folder in BCM to "Contacts" Dan Hardy Microsoft Outlook Contacts 3 6th Mar 2004 01:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:16 PM.