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/reference 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); ....
Can I use the method Attachments.Add to achieve this? do i have to alter the parameters?
in the link you can see the result. left attachment is added manually, right attachment is added programmatically by my addin http://web.inf.tu-dresden.de/~oj853436/studio/iTaskItem.Attachment.Add.GIF
I'd appreciate any suggestions!
Ciao Ole Jaekel
|
|