Question

If I select an Outlook message from my Inbox and copy it to the clipboard I can paste it as an *.msg file to the Desktop.

Now I want to implement the same feature to my application.

The Clipboard object contains the following elements:

RenPrivateSourceFolder
RenPrivateMessages
RenPrivateItem
FileGroupDescriptor
FileGroupDescriptorW
FileDrop
FileNameW
FileName
FileContents
Object Descriptor
System.String
UnicodeText
Text

FileGroupDescriptor contains a MemoryStream with the filename (Subject.msg) but I don't know how to create a copy from the outlook message from the Clipboard data, since none of the elements seem to contain the message itself.

Any Suggestions?

Was it helpful?

Solution

Here is an example: Outlook Drag and Drop in C#. The article works with drag and drop but it should be similar if not identical for working with clipboard.

OTHER TIPS

Not sure if this will work, but you have to do something like:

if (Clipboard.ContainsText(System.Windows.Forms.TextDataFormat.Text))
{
    IDataObject data = Clipboard.GetDataObject();
    Outlook.Application oApp = new Outlook.Application();
    Outlook.MailItem oMsg = (Outlook.MailItem)data.GetData(DataFormats.Text, true);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top