Drop a link to Outlook message

  • Thread starter Thread starter cold80
  • Start date Start date
C

cold80

Hi guys, maybe it's a silly question, but I'm quite stuck with it...
I've tried to implement a drag and drop operation from inside my c#
program. What I would like to do is allow to copy a link to an Outlook
message from my application. So I use:

button1.DoDragDrop("http://www.google.com", DragDropEffects.Copy);

The text string is copied correctly but Outlook doesn't recognize it
as a link. I have tried to use the HTML fragment for a link, but it's
always the same, the text is copied "as is". I don't understand why,
for example, I drag the URL from Firefox to the Outlook message...in
this case Outlook recognize it as a link and activate it. How can I do
the same in my application?

thank you in advance for your help

cold
 
cold,

Instead of passing a string (which is placed on the clipboard as text)
you have to place an object that implements IDataObject (the DataObject
class will work) and set the type to "UniformResourceLocator" or
"UniformResourceLocatorW" and pass a memory stream that has the ASCII or
Unicode string which is the URL you want to drop. This should allow you to
drop a URL wherever you want.
 
Thank you for your reply but actually it doesn't seem so easy. I mean,
you suggestion is quite right but I've read some new articles using
the trail you left me and I haven't found a solution that works with
different e-mail clients yet. Do you have an example or something? For
example I've found this one

http://www.codeproject.com/KB/cs/draginternetshortcut.aspx

but it doesn't work with Thunderbird for example...

thank you again for your help

cold
 
cold,

Regarding the article, I saw the same one, and to drag a URL, the only
thing you should have to populate is the UniformResourceLocator and
UniformResourceLocatorW data types on the DataObject.

Do you have some code that you are using to populate these?
 

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

Back
Top