This project has moved. For the latest updates, please go here.

Outlook 2013, can't retrieve folder list

Nov 12, 2012 at 9:13 AM

The following code used to work with Outlook 2010, with exchange 2003 and NetOffice [RC].

Now testing for new client using Outlook 2013 and pst files, all other outlook interaction is fine, i.e. sending email etc... but unable to loop around folders, it returns null folders.

Outlook.Application outlookApplication = new Outlook.Application();

Outlook._NameSpace outlookNS = outlookApplication.GetNamespace("MAPI");

Outlook.MAPIFolder objDefaultInboxFolder = outlookNS.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

for (int f = 1; f < outlookNS.Folders.Count; f++

Any ideas

Nov 13, 2012 at 10:22 PM
Edited Nov 13, 2012 at 10:23 PM

i do test today with outlook 2013 and window7 and i see its not applicable in outlook 2013.
i find a way for me based on this code snippet:

private void Main()
           Outlook.Application outlookApplication = new Outlook.Application();

private void EnumerateFoldersInDefaultStore(Outlook.Application outlookApplication)
            Outlook.MAPIFolder root = outlookApplication.Session.DefaultStore.GetRootFolder() as Outlook.MAPIFolder;
            EnumerateFolders(outlookApplication, root);

private void EnumerateFolders(Outlook.Application outlookApplication, Outlook.MAPIFolder folder)
            Outlook.Folders childFolders = folder.Folders as Outlook.Folders;
            if (childFolders.Count > 0)
                foreach (Outlook.MAPIFolder childFolder in childFolders)
                    EnumerateFolders(outlookApplication, childFolder);

Nov 14, 2012 at 3:16 PM

Hi Sebastian.

Thank you for your prompt reply.

Your code worked perfectly!!

I would also like to thank you for all your efforts, over the years I have written a lot of office interop  office code, but always using early binding. Your library is an exceptional body of work, which should act as an inspiration to us all.

Thanks for your amazing work!