I have looked high and low and can't seem to find some sample code anywhere.

I am looking for a snippet of code that will return all the folders in a Mailbox, not so much the drafts, inbox, outbox, sent items but a custom folder created by the user.

Using MS Outlook 2007 ver.12.

I know how the look for items in a folder but it only shows me the items in my Inbox. I need to show all the folders available and let the user select the folder to search in. Or at this point I would settle for a way to set the defaultfolder. I can make this accept anything other than olFolderInbox?

myFolder = olNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)

Thanks in Advance, this is driving me nuts.

update: i have managed to get all the available folders now I just need to set the current folder to look for unread items?

.pickfolder lets me pick it from a list but I want to set it through code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.