- Joined
- Dec 15, 2005
- Messages
- 4
- Reaction score
- 0
Hello everyone!
I would like to imitate Outlooks Drag & Drop functionality on this case:
When you drag and drop an email message into the body of a Outlook Task Item you normally receive a clickable link (named like the emails subject), which, when clicked, opens the dropped email.
I would like to create such a link using a ComAddIn. So far I tried and succeeded to add an email to a task item as an attachment. the email also appears in the body of the task item but is not clickable to open the email.
my source code looks like this:
Can I use the method Attachments.Add to achieve this? do i have to alter the parameters?
in the attachment you can see the result. left attachment manually, right attachment programmatically
I appreciate an suggestions!
Ciao Ole Jaekel
I would like to imitate Outlooks Drag & Drop functionality on this case:
When you drag and drop an email message into the body of a Outlook Task Item you normally receive a clickable link (named like the emails subject), which, when clicked, opens the dropped email.
I would like to create such a link using a ComAddIn. So far I tried and succeeded to add an email to a task item as an attachment. the email also appears in the body of the task item but is not clickable to open the email.
my source code looks like this:
Code:
using MOIO = Microsoft.Office.Interop.Outlook;
...
//get the task item
MOIO.NameSpace olNS = ((MOIO.Application)applicationObject).GetNamespace("MAPI");
MOIO.TaskItem iTaskItem = (MOIO.TaskItem) olNS.GetItemFromID(itemEntryID, itemStoreID);
//get the mail item (same subject)
MOIO.MailItem iMailItem = null;
MOIO.MAPIFolder oMailFolder = getFolder("Posteingang");
MOIO.Items oItems = oMailFolder.Items;
foreach (MOIO.MailItem mail in oItems){
if (mail.MessageClass == "IPM.Note" && mail.Subject.Equals(iTaskItem.Subject.ToString())) {
iMailItem = mail;
}
}
//add mail as attachment to task item
iTaskItem.Attachments.Add(iMailItem, MOIO.OlAttachmentType.olByReference, iTaskItem.Body.Length+1, iMailItem.Subject);
...
in the attachment you can see the result. left attachment manually, right attachment programmatically
I appreciate an suggestions!
Ciao Ole Jaekel