add toplevel folder

  • Thread starter Thread starter Dan Kjærgaard
  • Start date Start date
D

Dan Kjærgaard

Hi

Why can't I add a new folder at the toplevel of the Outlook folder hieraki.
The following VBA code results in an error:

Application.Session.Folders.Add ("MyNewFolder")

Can anyone help?
 
Your statement attempts to add not a new folder, but a new data store, since
that's what the top level of the hierarchy contains. You first need to
return the data store where you want to add folders, then add to its Folders
collection. For a solution that always works on the default data store, get
the Inbox with Namespace.GetDefaultFolder, then add to its Parent.Folders
collection.
 

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

Back
Top