Click here to Skip to main content
14,733,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
need c# code for show inbox sub folders in button click

i already created the code for create sub folders inside the inbox folder
it is as follows

private void btnSave_Click(object sender, EventArgs e)
           if (string.IsNullOrEmpty(txtSave.Text.Trim().ToString()))
               MessageBox.Show("Enter name");



       private void CreateInboxFolder()

           string folderName = txtSave.Text.ToString();
           OutLook._Application olApp = new OutLook.ApplicationClass();
           OutLook._NameSpace olNs = olApp.GetNamespace("MAPI");
           OutLook.MAPIFolder oInbox = olNs.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderInbox);
           OutLook.Folders oFolders = oInbox.Folders;
           OutLook.MAPIFolder oInboxFolders = oFolders.Add(folderName, OutLook.OlDefaultFolders.olFolderInbox);
           MessageBox.Show("Folder " + oInboxFolders.Name + " is Created");
           catch (Exception)

               MessageBox.Show(txtSave.Text + " folder already created please enter differetnt name");


pls tell me how to do it ... i was struck at that point in my project :confused::confused:
Updated 13-Jun-10 0:52am

1 solution

See here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900