M
micke.hovmoller
I want to create a task from an incoming e-mail such that the task
contains a link to the e-mail.
Right now I have this:
Sub creTask_as_WaitingFor()
Dim objApp
Dim objItem
Dim objTask
Dim myRecTime As String
Dim myTimeString As String
Dim myToString As String
' Get current item
Set objApp = CreateObject("Outlook.Application")
Set objItem = objApp.ActiveInspector.CurrentItem
' Format stuff - formatting is in Swedish so may look weird
myRecTime = CStr(objItem.ReceivedTime)
myTimeString = Mid(myRecTime, 9, 2) & Mid(myRecTime, 4, 2) &
Mid(myRecTime, 1, 2)
myToString = Replace(CStr(objItem.SenderName), "'", "")
' Create task and set fields
Set objTask = objApp.CreateItem(olTaskItem)
objTask.Subject = myToString & " - " & myTimeString & " - " &
objItem.Subject
objTask.Body = objItem.Body
objTask.ReminderSet = False
objTask.Categories = "5 - Waiting For"
objTask.Save
End Sub
This works well. It creates a task, sets the body to the body of the
e-mail, sets the subject etc.
However, when I open the task, I want it to have a link to the original
e-mail or a copy of the e-mail in the task or something similar, so
that I can reply to the e-mail without having to find it manually. It
doesn't matter much if it's actually a link or a copy. The idea is just
that I should be able to reply to the e-mail as quickly as possible
from the task.
If I manually drag the e-mail from the current folder and drop it on
the task, I will get the e-mail in the task, but I haven't figured out
how to do that programmatically.
contains a link to the e-mail.
Right now I have this:
Sub creTask_as_WaitingFor()
Dim objApp
Dim objItem
Dim objTask
Dim myRecTime As String
Dim myTimeString As String
Dim myToString As String
' Get current item
Set objApp = CreateObject("Outlook.Application")
Set objItem = objApp.ActiveInspector.CurrentItem
' Format stuff - formatting is in Swedish so may look weird
myRecTime = CStr(objItem.ReceivedTime)
myTimeString = Mid(myRecTime, 9, 2) & Mid(myRecTime, 4, 2) &
Mid(myRecTime, 1, 2)
myToString = Replace(CStr(objItem.SenderName), "'", "")
' Create task and set fields
Set objTask = objApp.CreateItem(olTaskItem)
objTask.Subject = myToString & " - " & myTimeString & " - " &
objItem.Subject
objTask.Body = objItem.Body
objTask.ReminderSet = False
objTask.Categories = "5 - Waiting For"
objTask.Save
End Sub
This works well. It creates a task, sets the body to the body of the
e-mail, sets the subject etc.
However, when I open the task, I want it to have a link to the original
e-mail or a copy of the e-mail in the task or something similar, so
that I can reply to the e-mail without having to find it manually. It
doesn't matter much if it's actually a link or a copy. The idea is just
that I should be able to reply to the e-mail as quickly as possible
from the task.
If I manually drag the e-mail from the current folder and drop it on
the task, I will get the e-mail in the task, but I haven't figured out
how to do that programmatically.