Microsoft KB Archive/263258

= How To Programmatically Embed a Hyperlink to a Message =

Article ID: 263258

Article Last Modified on 7/2/2004

-

APPLIES TO


 * Microsoft Collaboration Data Objects 1.2
 * Microsoft Collaboration Data Objects 1.21

-



This article was previously published under Q263258



SUMMARY
It may be necessary to send a message that contains a shortcut (or hyperlink) to a public folder or message. By clicking on the hyperlink, the recipient can easily reach the specified public folder or message. Note that to open items or files from a public folder, the recipient must have the appropriate permissions to the folder.

You can use Extended Messaging Application Programming Interface (MAPI) or the Microsoft Outlook Object Model to embed hyperlinks to messages. In the Outlook Object Model, you need to add the hyperlink as an attachment to the message. You also need to specify olEmbeddedItem(5) as the olAttachmentType constant.

CDO 1.2x does not directly support embedding hyperlinks to messages. With CDO 1.2x, you can only attach a copy of a message into another message, specifying the attachment type as CdoEmbeddedMessage. This article presents a limited workaround for that.



MORE INFORMATION
With CDO 1.2x, you can create a hyperlink to an Outlook folder or item by including a URL of type outlook:// within the body of a message. Because outlook:// is an Outlook-specific protocol, this method works only if the recipient views the messages by using an Outlook client.

You can use the outlook:// protocol in two different formats within the message text. The following examples assume that objMessage is a valid CDO 1.2x Message object that contains a hyperlink to a public folder message, objLinkedMessage: ' The following code displays the EntryID of objLinkedMessage in the URL. ' Because EntryID always uniquely identifies a message, this approach is safe to use.

objMessage.Text = &quot;Please check out the following message.&quot; & vblf _ & &quot;outlook:&quot; & objLinkedMessage.ID

' The following code displays the subject of the message in the URL. ' You should use this only if you know that the subject of the message ' would uniquely identify the objLinkedMessage under the folder &quot;My Public Folder&quot;.

objMessage.Text = &quot;Please check out the following message.&quot; & vblf _ & &quot;&quot;

