How to create a folder in a C++ add-in ?

  • Thread starter Thread starter Paul Keogh
  • Start date Start date
P

Paul Keogh

I've tried

spApplication -> CreateObject ("Outlook.MAPIFolder", &spFolder);

but it does'nt work.

I guess "Outlook.MAPIFolder" is the wrong object name - any suggestions ?
 
MAPIFolder.Folders.Add will create a child subfolder of MAPIFolder.
MAPIFolder can come either from Namespace.Folders collection or from
Namespace.GetDefaultFolder().

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Dmitry Streblechenko said:
MAPIFolder.Folders.Add will create a child subfolder of MAPIFolder.
MAPIFolder can come either from Namespace.Folders collection or from
Namespace.GetDefaultFolder().

Hi,

Thanks for your answer. Here is the method I invoke for the Add() as you
describe above;


[id(0x0000005f), helpcontext(0x004debcc)]
HRESULT Add([in] BSTR Name, [in, optional] VARIANT Type, [out, retval]
MAPIFolder** Folder);

But;
* What should Name be ? Just the name of the new folder ("mynewfolder") or
the full path ("Inbox\mynewfolder") ?
* What are the range of values for Type ?
* Where can I find documentation on the arguments to methods in the Outlook
type library ?

Thanks,
Paul.
 
1. Just the name ("mynewfolder")

2. From the help file:
expression.Add(Name, Type)
expression Required. An expression that returns a Folders object.
Name Required String. The display name for the new folder.
Type Optional Long. The Outlook folder type for the new folder. If the
folder type is not specified, the new folder will default to the same type
as the folder in which it is created. Can be one of the following
OlDefaultFolders constants: olFolderCalendar, olFolderContacts,
olFolderDrafts, olFolderInbox, olFolderJournal, olFolderNotes, or
olFolderTasks. (The constants olFolderDeletedItems, olFolderOutbox, and
olFolderSentMail cannot be specified for this argument.)

3. See VBAOL10.CHM help file - Make sure you install VBA files when
installing Ooffice. Also see http://www.slipstick.com - it will be much more
helpful than the VBA help file.

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


Paul Keogh said:
Dmitry Streblechenko said:
MAPIFolder.Folders.Add will create a child subfolder of MAPIFolder.
MAPIFolder can come either from Namespace.Folders collection or from
Namespace.GetDefaultFolder().

Hi,

Thanks for your answer. Here is the method I invoke for the Add() as you
describe above;


[id(0x0000005f), helpcontext(0x004debcc)]
HRESULT Add([in] BSTR Name, [in, optional] VARIANT Type, [out, retval]
MAPIFolder** Folder);

But;
* What should Name be ? Just the name of the new folder ("mynewfolder") or
the full path ("Inbox\mynewfolder") ?
* What are the range of values for Type ?
* Where can I find documentation on the arguments to methods in the Outlook
type library ?

Thanks,
Paul.
 
Back
Top