Question

I searched all over for this thing but no luck yet. I have an add-in (for outlook) which performs several operations on the Outlook Items(Appointment Item, task). I just want to override the event when you drag a file onto the body of item and it gets displayed on the body of the item. I just want that item to be attached (& store it at a dir of my choice). How do I link the event ?? I found one event though.

but in the example, there is a form always. I don't have a specific form as it's an add-in :(

private void Body_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
    {
        // Ensure that the list item index is contained in the data. 
        if (e.Data.GetDataPresent(typeof(System.String)))
        {

            Object item = (object)e.Data.GetData(typeof(System.String));

            // Perform drag-and-drop, depending upon the effect. 
            if (e.Effect == DragDropEffects.Copy ||
                e.Effect == DragDropEffects.Move)
            {

                // Insert the item. 
                System.Windows.Forms.MessageBox.Show("there");

            }
        }
    }

I found the rest of the details but I am unable to find the event to override.

Please help. Thanks in advance.

for info : I already gone through these links: 1, 2, 3 .

EDIT:

My code of adding the appointment is :

public bool getAppointments(IList<IAppointmentData> list)
        {
            Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
            Microsoft.Office.Interop.Outlook.Explorer expl =  outlookApp.ActiveExplorer();

            try
            {
                if (list.Count != 0)
                {
                    deleteExisting();
                    foreach (IAppointmentData appointmentData in list)
                    {
                        Microsoft.Office.Interop.Outlook._AppointmentItem appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)
                            outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
                        appt = setMeetingDetails(appt, appointmentData);

                        appt.Recipients.ResolveAll();
                        appt.Save();
                    }
                }

            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
                return false;
            }

            return true;
        }

I need some mechanism to attach the event listed above to the appointment item body when someone drops a file into the body. How do I do it?

Was it helpful?

Solution

There is no officially supported API to do that. I can only think of dropping down to the Windows API level: you can find the window handle of the editor control, then install your own drag/drop handler using RegisterDragDrop(). Not sure if you can do that in C#... It is definitely doable in C++ or Delphi.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top