Adding a folder to Outlook with VCL code

Add-in Express™ Support Service
That's what is more important than anything else

Adding a folder to Outlook with VCL code
VCL Example to add a folder to outlook 
John Taylor




Posts: 10
Joined: 2012-08-20
I am using the example of displaying a property page when the inbox folder is selected, right click select
'Properties'. I would like to add a folder 'My Folder' using this example and display properties page when
'My folder' is accessed for properties.

How do I add the folder 'My Folder' and where do I do that ?

An example using VCL code would be appreciated, I do not know anything about .net and very little of
the outlook object model so what event handler/where do I put the code and what is an example ?

Please ?

Thanks
John
Posted 29 Aug, 2012 04:58:23 Top
Andrei Smolin


Add-in Express team


Posts: 14976
Joined: 2006-05-11
Hi John,

To create a subfolder (FolderB) of a folder (FolderA), you need to call FolderA.Folders.Add('Folder B', EmptyParam). You can call this at add-in startup or by clicking a button. Please check this sample project:
http://www.add-in-express.com/files/projects_pub/adx-ol-user-props-example.zip.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Aug, 2012 05:55:47 Top
John Taylor




Posts: 10
Joined: 2012-08-20
Andrei,

Just exactly what I need ! Thanks for the speedy and on-target reply !

John
Posted 29 Aug, 2012 06:40:51 Top
Andrei Smolin


Add-in Express team


Posts: 14976
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Aug, 2012 06:47:53 Top
John Taylor




Posts: 10
Joined: 2012-08-20
Your example made things clearer, but how would I add a folder at the same lever as the inbox instead of adding a subfolder to inbox ?

That one seems to be trickier, as I don't find a folder constant to get the Parent of the inbox or in other
words the root folder 'Personal Folders'.

Can you enlighten me ?

thanks
John
Posted 29 Aug, 2012 09:34:13 Top
Andrei Smolin


Add-in Express team


Posts: 14976
Joined: 2006-05-11
Then you need to create a subfolder of the parent folder for Inbox. Assuming that the MAPIFolder object representing the Inbox folder is stored in InboxFolder, then call InboxFolder.Parent and cast the result to MAPIFolder. To get the MAPIFolder object representing the Inbox folder, call OutlookApp.Session.GetDefaultFolder(olFolderInbox).

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Aug, 2012 10:05:13 Top