![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
Ads |
#2
|
|||
|
|||
![]()
To get a non-default folder, instead of GetDefaultFolder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Charlie" wrote in message ... 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 |
#3
|
|||
|
|||
![]()
Set objFolder = GetFolder("Public Folders/All Public Folders/Company/Sales")
Hi again. My folder "Work Contacts" is in the list with the other outlook items, like Contacts, Calendar, Inbox, etc. I haven't made any other folders, and when I click the properties of "Work Contacts" is says the location is \\Personal Folders. So should I use Set objFolder = GetFolder("Public Folders/Personal Folders\Work Contacts")? thanks, ck |
#4
|
|||
|
|||
![]()
Look in the Folder List navigation pane. The path to the folder in question needs to ***exactly*** match the names of the branches in its hierarchy, just like the path to a file in the file system. Why would you include Public Folders if It's not a part of the hierarchy above Work Contacts?
Also, if you have Outlook Spy and Outlook 2002 or later, you can check the value of the FolderPath property. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Charlie" wrote in message ... Set objFolder = GetFolder("Public Folders/All Public Folders/Company/Sales") Hi again. My folder "Work Contacts" is in the list with the other outlook items, like Contacts, Calendar, Inbox, etc. I haven't made any other folders, and when I click the properties of "Work Contacts" is says the location is \\Personal Folders. So should I use Set objFolder = GetFolder("Public Folders/Personal Folders\Work Contacts")? thanks, ck |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA Code to put in Access that will send an Email with Attachments | [email protected] | Outlook and VBA | 1 | April 9th 06 06:30 PM |
Outlook not displaying attachment from Access via code | [email protected] | Outlook - General Queries | 4 | February 28th 06 12:30 AM |
how to do coding in ms access 2000 and setting different properti | saif | Outlook - Using Forms | 1 | February 10th 06 01:57 PM |
Link Access Table to Exchange Public Folder Contacts | Brian | Outlook - Using Contacts | 0 | January 29th 06 09:05 PM |
Running query from Access Form commmand using VBA code | Berny | Outlook and VBA | 4 | January 16th 06 03:12 PM |