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.
 
Back
Top