How to use a specific outlook contact folder other than the defaul

S

Southern at Heart

I use the below code to have the user choose an outlook folder, but what if I
need my code to just use a specific folder (other than the default one)
without asking the user. The folder is called "my contacts"
This is what I use for the pickfolder, but if they opted to use my default
folder "my contacts" how do I do this?
thanks,
SouthernAtHeart


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.PickFolder
If cf Is Nothing Then
MsgBox "No folder chosen ...action canceled"
End
End If
If cf.DefaultItemType <> olContactItem Then
MsgBox "You choose an outlook folder that is not a contact folder"
End
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top