Help with dragging and dropping

P

PromisedOyster

Version: Outlook 2000: 9.0.0.2711
Platform: XP Professional


We have a C#/WinForms application. This supports drag and drop from
Outlook for emails and calendar appointments.

We have a number of forms in our application that support drag and
drop.

In the code, we don't explicitly delete from the email folder or the
calendar once the drop has been completed.


However, when we drop the selected items onto one of our forms, the
selected items are not getting deleted from Outlook. However, in other
forms, they are being deleted. The code is exactly the same in all
forms as they are using a common class.

As far as I am aware, the only difference is the controls on the forms
that support drag and drop AND the type of forms. It is the MDI forms
that cause the item to be deleted (the form and all child controls
support drag and drop in one instance. The other instance is dropping
onto a line on a grid) but not the main form (only a toolbar button
supports drag and drop). However, this seems strange.


Does anyone have any clues as to why this could be happening, and more
importantly how to stop the items being deleted?


Also, what is the expected behaviour from Outlook? Reomve after being
dropped or NOT?


Sample code:


this.DragDrop += new
System.Windows.Forms.DragEventHandler(this.DragDrop);
this.DragEnter += new
System.Windows.Forms.DragEventHandler(this.DragEnter);
this.AllowDrop = true;


private void DragDrop(object sender, System.Windows.Forms.DragEventArgs

e)
{
OutlookManager om = new OutlookManager();
if (om.IsDraggingOutlookItems(e))
{
om.SaveSelectedItems();
}
}


private void DragEnter(object sender,
System.Windows.Forms.DragEventArgs e)
{
OutlookManager om = new OutlookManager();
if (om.IsDraggingOutlookItems(e))
{
e.Effect = DragDropEffects.Move;
}
 
G

Guest

That IS strange. The expected behaviour in Outlook when left-clicking and
dragging an item to another folder is to move it; CTRL+ left click copies it.
Right-clicking and dragging gives you a mini context menu to choose Copy or
Move.

Since Outlook offers no drag events in the object model, the only control I
believe destination forms has is to work with the passed item. You wouldn't
be able to control if it is a move or a copy - only the user can control that
with the action they use.

You may be able to cancel a drag operation, but if the user did a move, you
may have to retrieve the original since it could very well have been deleted.
Hang on here - if this happened, the original didn't go anywhere - it would
be deleted because the destination didn't make a copy of the dragged item.
But then you say some drags aren't removing the original item...

I don't know; I'm just guessing and thinking out loud here. I've never
played with custom apps receiving dragged objects from Outlook.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top