Move selected e-mails to Personal inbox Folders Files

Posted by kasunmit on Stack Overflow See other posts from Stack Overflow or by kasunmit
Published on 2010-06-12T17:20:19Z Indexed on 2010/06/12 17:22 UTC
Read the original article Hit count: 225

Filed under:
|
|

Hi, 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); txtInboxFolderName.Focus(); return; } else { CreateNewInboxFolder(); } } private void CreateNewInboxFolder() { try { 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", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtInboxFolderName.Focus(); } }

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET