Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a TaskRequestItem Object and send?

Status
Not open for further replies.

brtek

Programmer
Jan 22, 2004
1
BR
Here is the example from Outlook help:

Unlike other Microsoft Outlook objects, you cannot create this object. When the sender applies the Assign and Send methods to a TaskItem object to assign (delegate) the associated task to another user, the TaskRequestItem object is created when the item is received in the recipient's Inbox.

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olTaskItem)
myItem.Assign
Set myDelegate = myItem.Recipients.Add("Jeff Smith")
myItem.Subject = "Prepare Agenda For Meeting"
myItem.DueDate = #9/20/97#
myItem.Send

I tried but didn't work.

How should I declare this variable (myDelegate) ?
 
Hi brtek

I have been struggeling with the same problem, the below code have I in use and working.

Dim OlApp As Outlook.Application
Dim ObjTask As Outlook.TaskItem

Set OlApp = CreateObject("Outlook.Application")
Set ObjTask = OlApp.CreateItem(olTaskItem)

With ObjTask
.Assign
Set mydelegate = .Recipients.Add("Name of personto get delegation")
mydelegate.Resolve ' Looks up name in Exchange
If mydelegate.Resolved Then
.Subject = "Subject line"
.Body = "Body content"
.StartDate = Now
.DueDate = DateAdd("d", 30, Now)
.ReminderSet = True
.ReminderTime = DateAdd("d", 23, Now)
.Display
.Send
Else
Exit Function
End If
End With

.Display can be omitted if you want the task sent directly and without looking at it first.
I use this code in Access 2003 in conjunction with Exchange 2000

Regards

Gerth Ericsson
 
Hi again brtek.

Was a little fast in my first reply.
The code supplied works if you do not have stated "Option explicit" in the module.

If you use "Option Explicit" you need to use
Dim myRecipient As Recipient

/Regards

Gerth Ericsson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top