Click here to Skip to main content
11,922,641 members (56,923 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#3.0 C# Outlook

I am creating sub folders inside the inbox folder using following code.
private void btnCreate_Click(object sender, EventArgs e)
    if (string.IsNullOrEmpty(txtInboxFolderName.Text.Trim().ToString()))
        MessageBox.Show("Enter name of the folder", "Null value", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
private void CreateNewInboxFolder()
        string folderName = txtInboxFolderName.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", "Create inbox folder", MessageBoxButtons.OK, MessageBoxIcon.Information);
    catch (Exception)
        MessageBox.Show("Folder name: " + txtInboxFolderName.Text +" is already created" + "\nPlease enter different folder name",
From the above code I can create sub folder inside the Inbox folder. Then what I need to do is save the e-mail into that created folder. Please help me to do it.

I think we can import those folder names to a separate form and select one from there, then I can save e-mails (e-mail datails is in the data grid and I need to save them to new folder)

Please help me with the code.

I am very confused and I'm not sure how to do it.
Cry | :(( D'Oh! | :doh:
Posted 12-Jun-10 4:46am
Edited 12-Jun-10 7:32am

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151125.1 | Last Updated 12 Jun 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100