How to Link a Task Item to a Contact (OL2000)

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,

im attempting to Link a Task Item to a ContactItem with following code. The
I've placed a Button on a ContactItem and want to create automaticly a Task
whitch is linked to the contact.
My Problem seems to be: how can I get the object from my Contact in the
myContactItem filed?

sub cbCreateTask_click()
Dim objOutlook 'As Outlook.Application
Dim objNamespace 'As Outlook.Namespace
Dim objTaskItem 'As Outlook.TaskItem

set myContactItem = Application.ActiveInspector.CurrentItem

Set objTaskItem = Application.CreateItem(3) 'olTaskItem = 3
Set objNamespace = Application.GetNamespace("MAPI")

With objTaskItem
.Subject = "Test"
.Body= "Test"
.DueDate = now
.StartDate = now
.ReminderSet = True
.ReminderTime = now
.Links.Add myContractItem 'With this commandline i want to link the
Contact to the Task

end with

objTaskItem.Display

Set objOutlook = Nothing
Set objNamespace = Nothing
Set objTaskItem = Nothing
end sub

Thanks in advace for any hint.

Martin
 
If this code is running inside your contact, then you don't use
Application.ActiveInspector.CurrentItem. The current item is simply the
intrinsic Item object:

objtaskItem.Links.Add Item
 
Back
Top