Creating a new contacts folder

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 ;)
 
D

Dmitry Streblechenko

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
 
K

Kennedy

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.
 
D

Dmitry Streblechenko

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
 

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