Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Dropping Emails onto a .NET Application

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Thu, Aug 19, 2010, 12:59 PM


This page is a Draft. Its content is not complete and might contain errors.

Overview



Walkthrough

1. Create a new C# Windows Application in Visual Studio

2. Add a COM reference to Microsoft Outlook 10.0 Object Library.

3. Drop a textbox onto Form1.

4. Add the following code to Form1.

{copytext|div1}
using System.Windows.Forms;

namespace DragDropTest
{
    public partial class Form1 : Form
    {
        //=========================================================================================
        public Form1()
        {
            InitializeComponent();
        }
        //=========================================================================================
        private void textBox1_DragOver(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("RenPrivateMessages"))
                e.Effect = DragDropEffects.Copy;
        }
        //=========================================================================================
        private void textBox1_DragDrop(object sender, DragEventArgs e)
        {
            Outlook._Application app = new Outlook.Application();
            Outlook.Selection item = app.ActiveExplorer().Selection;

            for (int i = 1; i <= item.Count; i++)
            {
                Outlook.MailItem email = item.Item(1) as Outlook.MailItem;
                string from = email.SenderName;
            }
        }
    }
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.