Connecting Tech Pros Worldwide Forums | Help | Site Map

Drag and drop of emails from outlook to my C# application

Johann Wagner
Guest
 
Posts: n/a
#1: Nov 15 '05
Hello!

I want to drop an email in my C# application. I get the drop event and the
dataobject. But i cannot interpret the data in the dataobject. So i cannot
get the email. I have found a code sample for getting appendix via
drag&drop, but this doesn't work for the email, too. Can somebody give me a
tip how i can get the email?

Regards,
Johann



Dmitry Streblechenko
Guest
 
Posts: n/a
#2: Nov 15 '05

re: Drag and drop of emails from outlook to my C# application


Unless you are using Extended MAPI, there is no way to do that - besides a
couple of internal formats, drag data contains messages in the MSG format.
Or, since a user must select the messages in Outlook first to drag them,
simply query Application.ActiveExplorer.Selection collection.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Johann Wagner" <johann.wagner@dieeinspritzer.at> wrote in message
news:%23DaHRQ0rDHA.3532@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hello!
>
> I want to drop an email in my C# application. I get the drop event and the
> dataobject. But i cannot interpret the data in the dataobject. So i cannot
> get the email. I have found a code sample for getting appendix via
> drag&drop, but this doesn't work for the email, too. Can somebody give me[/color]
a[color=blue]
> tip how i can get the email?
>
> Regards,
> Johann
>
>[/color]


Johann Wagner
Guest
 
Posts: n/a
#3: Nov 15 '05

re: Drag and drop of emails from outlook to my C# application


Hello Dmitry,

thank you for your help! I can get the actual selection as you described.

But you wrote that the drag data contains messages in MSG format. Can i get
the messages and save them to .msg files?
The FileContents Data is null so i think it must be the RenPrivateMessages.
Is that right? Can i separate the msg files from there?
Do you know how i can do that?

Johann

"Dmitry Streblechenko" <dmitry@dimastr.com> schrieb im Newsbeitrag
news:umGry6EsDHA.1692@TK2MSFTNGP12.phx.gbl...[color=blue]
> Unless you are using Extended MAPI, there is no way to do that - besides a
> couple of internal formats, drag data contains messages in the MSG format.
> Or, since a user must select the messages in Outlook first to drag them,
> simply query Application.ActiveExplorer.Selection collection.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Johann Wagner" <johann.wagner@dieeinspritzer.at> wrote in message
> news:%23DaHRQ0rDHA.3532@TK2MSFTNGP11.phx.gbl...[color=green]
> > Hello!
> >
> > I want to drop an email in my C# application. I get the drop event and[/color][/color]
the[color=blue][color=green]
> > dataobject. But i cannot interpret the data in the dataobject. So i[/color][/color]
cannot[color=blue][color=green]
> > get the email. I have found a code sample for getting appendix via
> > drag&drop, but this doesn't work for the email, too. Can somebody give[/color][/color]
me[color=blue]
> a[color=green]
> > tip how i can get the email?
> >
> > Regards,
> > Johann
> >
> >[/color]
>
>[/color]


Dmitry Streblechenko
Guest
 
Posts: n/a
#4: Nov 15 '05

re: Drag and drop of emails from outlook to my C# application


You need to use the CF_HDROP format and DragQueryFile() to access the
temporary file names.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Johann Wagner" <johann.wagner@dieeinspritzer.at> wrote in message
news:ux5YA2psDHA.700@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hello Dmitry,
>
> thank you for your help! I can get the actual selection as you described.
>
> But you wrote that the drag data contains messages in MSG format. Can i[/color]
get[color=blue]
> the messages and save them to .msg files?
> The FileContents Data is null so i think it must be the[/color]
RenPrivateMessages.[color=blue]
> Is that right? Can i separate the msg files from there?
> Do you know how i can do that?
>
> Johann
>
> "Dmitry Streblechenko" <dmitry@dimastr.com> schrieb im Newsbeitrag
> news:umGry6EsDHA.1692@TK2MSFTNGP12.phx.gbl...[color=green]
> > Unless you are using Extended MAPI, there is no way to do that - besides[/color][/color]
a[color=blue][color=green]
> > couple of internal formats, drag data contains messages in the MSG[/color][/color]
format.[color=blue][color=green]
> > Or, since a user must select the messages in Outlook first to drag them,
> > simply query Application.ActiveExplorer.Selection collection.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> >
> > "Johann Wagner" <johann.wagner@dieeinspritzer.at> wrote in message
> > news:%23DaHRQ0rDHA.3532@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > Hello!
> > >
> > > I want to drop an email in my C# application. I get the drop event and[/color][/color]
> the[color=green][color=darkred]
> > > dataobject. But i cannot interpret the data in the dataobject. So i[/color][/color]
> cannot[color=green][color=darkred]
> > > get the email. I have found a code sample for getting appendix via
> > > drag&drop, but this doesn't work for the email, too. Can somebody give[/color][/color]
> me[color=green]
> > a[color=darkred]
> > > tip how i can get the email?
> > >
> > > Regards,
> > > Johann
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Johann Wagner
Guest
 
Posts: n/a
#5: Nov 15 '05

re: Drag and drop of emails from outlook to my C# application


Thanks for the tool, but i didn't get the dragdrop data from clipboard.
Maybe it depends on that i am using CSharp and the .NET Framework.


"Matthew Chestnut" <NOSPAM_matthew_chestnut@hotmail.com> schrieb im
Newsbeitrag news:ohn6svkdqfjgsjopj53jif8300t7hshq03@4ax.com...[color=blue]
> FYI, this ClipSpy tool is useful for seeing what's on the clipboard
> (used by drag-n-drop):
>
> http://home.inreach.com/mdunn/code/ClipSpy/clipspy.html
>
> On Mon, 24 Nov 2003 09:55:37 +0100, "Johann Wagner"
> <johann.wagner@dieeinspritzer.at> wrote:
>[color=green]
> >Hello Dmitry,
> >
> >thank you for your help! I can get the actual selection as you described.
> >
> >But you wrote that the drag data contains messages in MSG format. Can i[/color][/color]
get[color=blue][color=green]
> >the messages and save them to .msg files?
> >The FileContents Data is null so i think it must be the[/color][/color]
RenPrivateMessages.[color=blue][color=green]
> >Is that right? Can i separate the msg files from there?
> >Do you know how i can do that?
> >
> >Johann[/color]
>[/color]


Johann Wagner
Guest
 
Posts: n/a
#6: Nov 15 '05

re: Drag and drop of emails from outlook to my C# application


Hello Dmitry,

i use CSharp, so i cannot use DragQueryFile(). The format CF_HDROP is not
available, too.

The formats available are:

RenPrivateSourceFolder
RenPrivateMessages
FileGroupDescriptor
FileContents
Object Descriptor
System.String
UnicodeText
Text

The first 3 are MemoryStreams which i cannot interpret.
The FileContents is always null.
Object Descriptor is MemoryStream which i cannot interpret, too
Others are strings with the mail subject.

Do you know how i can access it in CSharp?

Johann


Dmitry Streblechenko
Guest
 
Posts: n/a
#7: Nov 15 '05

re: Drag and drop of emails from outlook to my C# application


I have no idea, but I would imagine that you can access Windows API
functions from C#.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Johann Wagner" <johann.wagner@dieeinspritzer.at> wrote in message
news:eTlXcUPtDHA.540@tk2msftngp13.phx.gbl...[color=blue]
> Hello Dmitry,
>
> i use CSharp, so i cannot use DragQueryFile(). The format CF_HDROP is not
> available, too.
>
> The formats available are:
>
> RenPrivateSourceFolder
> RenPrivateMessages
> FileGroupDescriptor
> FileContents
> Object Descriptor
> System.String
> UnicodeText
> Text
>
> The first 3 are MemoryStreams which i cannot interpret.
> The FileContents is always null.
> Object Descriptor is MemoryStream which i cannot interpret, too
> Others are strings with the mail subject.
>
> Do you know how i can access it in CSharp?
>
> Johann
>
>[/color]


Johann Wagner
Guest
 
Posts: n/a
#8: Nov 15 '05

re: Drag and drop of emails from outlook to my C# application


Thanks for your help!


"Dmitry Streblechenko" <dmitry@dimastr.com> schrieb im Newsbeitrag
news:uT1NM7StDHA.2408@tk2msftngp13.phx.gbl...[color=blue]
> I have no idea, but I would imagine that you can access Windows API
> functions from C#.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Johann Wagner" <johann.wagner@dieeinspritzer.at> wrote in message
> news:eTlXcUPtDHA.540@tk2msftngp13.phx.gbl...[color=green]
> > Hello Dmitry,
> >
> > i use CSharp, so i cannot use DragQueryFile(). The format CF_HDROP is[/color][/color]
not[color=blue][color=green]
> > available, too.
> >
> > The formats available are:
> >
> > RenPrivateSourceFolder
> > RenPrivateMessages
> > FileGroupDescriptor
> > FileContents
> > Object Descriptor
> > System.String
> > UnicodeText
> > Text
> >
> > The first 3 are MemoryStreams which i cannot interpret.
> > The FileContents is always null.
> > Object Descriptor is MemoryStream which i cannot interpret, too
> > Others are strings with the mail subject.
> >
> > Do you know how i can access it in CSharp?
> >
> > Johann
> >
> >[/color]
>
>[/color]


Closed Thread