How can I save a Outlook Message from Clipboard to a file?
문제
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?
해결책
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.
다른 팁
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);
}
제휴하지 않습니다 StackOverflow