Getting a copied email from the clipboard

MatthewD

I have a listview that is showing the contents of a directory. I have enabled drag and drop into the listview so users can drag a file from Windows Explorer and drop it into the listview. I then copy those files to the directory that is being displayed in the listview.

If you drag an email from outlook onto the desktop or into a folder in Windows explorer it creates a .msg file of the email. The users now want to drag emails from outlook and drop them into the listview.

When an email is drug over the listview, it doesn't see it as a valid drag/drop object. The cursor is a circle with a line through it instead of the drop event cursor.

In the listView1_DragEnter event I have

        if (e.Data.GetDataPresent(DataFormats.FileDrop))
        {
            e.Effect = DragDropEffects.All;
        }
        else
        {
            e.Effect = DragDropEffects.None;
        }

I have tried DataFormats.HTML but that doesn't see anything to drop either. Any ideas?

The email are dragged from the list section in Outlook.
enter image description here

Marc

In the listview's DragEnter Event, return the following DragDropEffects:

private void listView_DragEnter(object sender, DragEventArgs e)
{
    e.Effect = DragDropEffects.All;
}

To extract and read the Outlook message(s) within the DragDrop event, I recommend using this library. It is very easy to use:

private void listView_DragDrop(object sender, DragEventArgs e)
{
    OutlookDataObject dataObject = new OutlookDataObject(e.Data);

    //get the names and data streams of the files dropped
    string[] filenames = (string[])dataObject.GetData("FileGroupDescriptor");
    MemoryStream[] filestreams = (MemoryStream[])dataObject.GetData("FileContents");

    for (int fileIndex = 0; fileIndex < filenames.Length; fileIndex++)
    {
        string filename = filenames[fileIndex];
        MemoryStream filestream = filestreams[fileIndex];

        OutlookStorage.Message message = new OutlookStorage.Message(filestream);

        // do whatever you want with "message"

        message.Dispose();
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

get data from clipboard (copied from Powerpoint)

From Dev

Prevent line numbers from being copied to clipboard

From Dev

Paste Copied File From Clipboard To File System

From Dev

Unnecessary data getting copied to clipboard along with required contents

From Dev

Preserve contents of clipboard when a programs from text from copied exits

From Dev

How to prevent Ditto clipboard manager from saving text copied in KeepPassXC?

From Dev

Accessing text copied to clipboard by python

From Dev

Getting email from GraphUser with Permissions

From Dev

how can I paste copied-clipboard text to a file from terminal?

From Dev

Prevent Excel from clearing copied data for pasting, after certain operations, without Office clipboard

From Dev

how can I paste copied-clipboard text to a file from terminal?

From Dev

How to paste image from clipboard to Outlook email Body?

From Dev

Where are segments getting copied to and from in parse_elf() in the Linux kernel?

From Dev

Change the clipboard style in email

From Dev

How to load a stream with a file copied in Windows clipboard

From Dev

Diodon does not save anything copied to the clipboard

From Dev

Image copied to clipboard doesn't persist on Linux

From Dev

Getting the value of the clipboard

From Dev

getting clipboard support for vim

From Dev

UWP: Getting the Clipboard Text

From Dev

Getting Email Address from LinkedIn API

From Dev

Getting user email from Twitter using Satellizer

From Dev

Getting user email from Twitter using Satellizer

From Dev

Getting email address from a Recipient object

From Dev

Email is not getting triggerred from Logstash - ELK stack

From Dev

Why is this object is not getting copied by value

From Dev

Why is this object is not getting copied by value

From Dev

File deleted without getting copied

From Dev

Copied data to clipboard get lost whenever I close the frame

Related Related

  1. 1

    get data from clipboard (copied from Powerpoint)

  2. 2

    Prevent line numbers from being copied to clipboard

  3. 3

    Paste Copied File From Clipboard To File System

  4. 4

    Unnecessary data getting copied to clipboard along with required contents

  5. 5

    Preserve contents of clipboard when a programs from text from copied exits

  6. 6

    How to prevent Ditto clipboard manager from saving text copied in KeepPassXC?

  7. 7

    Accessing text copied to clipboard by python

  8. 8

    Getting email from GraphUser with Permissions

  9. 9

    how can I paste copied-clipboard text to a file from terminal?

  10. 10

    Prevent Excel from clearing copied data for pasting, after certain operations, without Office clipboard

  11. 11

    how can I paste copied-clipboard text to a file from terminal?

  12. 12

    How to paste image from clipboard to Outlook email Body?

  13. 13

    Where are segments getting copied to and from in parse_elf() in the Linux kernel?

  14. 14

    Change the clipboard style in email

  15. 15

    How to load a stream with a file copied in Windows clipboard

  16. 16

    Diodon does not save anything copied to the clipboard

  17. 17

    Image copied to clipboard doesn't persist on Linux

  18. 18

    Getting the value of the clipboard

  19. 19

    getting clipboard support for vim

  20. 20

    UWP: Getting the Clipboard Text

  21. 21

    Getting Email Address from LinkedIn API

  22. 22

    Getting user email from Twitter using Satellizer

  23. 23

    Getting user email from Twitter using Satellizer

  24. 24

    Getting email address from a Recipient object

  25. 25

    Email is not getting triggerred from Logstash - ELK stack

  26. 26

    Why is this object is not getting copied by value

  27. 27

    Why is this object is not getting copied by value

  28. 28

    File deleted without getting copied

  29. 29

    Copied data to clipboard get lost whenever I close the frame

HotTag

Archive