Creating a new contacts folder

  • Thread starter Thread starter Kennedy
  • Start date Start date
K

Kennedy

How do I create a new folder inside the contacts default
folder?

Once a new folder is created I can use the move method to
place it in the contacts default folder, but I just can't
seem to find an add or create method.

Simple question that I just can't seem to be able to
figure out. Making me feel pretty inadequate actually ;)
 
set ContactsFolder = Application.Session.GetDefaultFolder(olFolderContacts)
set NewFolder = ContactsFolder.Folders.Add("My newest folder")

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Thanks,

unfortunately tihs must be one of those times when the VB
and C++ go their separate ways as there is no "Folders"
method within the ContactsFolder object.

ie: I can do this:
MAPIFolder pNewFolder = pFldrContact.GetFolders()
but I can't do this:
MAPIFolder pNewFolder = pFldrContact.Folders.Add

and unfortunately their is no "Add" method in the former
and the latter just doesn't exist for Folders. So I'm at a
loss once again.

Thanks for the effort though.

Someone really ought to write a c++ book.
 
It really doesn't make a difference whether you are using
VB/C++/Delphi/whatever - the language syntax is different, plus VB lets you
use default methods/properties implicitly. Why can't you use something like

MAPIFolder pNewFolder = pFldrContact.GetFolders()->Add("whatever",
olFolderContacts)

In the worst case look at the header file with the wraper classes created by
VC++ when you imported the type library to figure out the correct names and
parameters.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top