PDA

View Full Version : how to Auto accept a task item



charmer
05-16-2006, 07:20 AM
I am using outlook 2003 you can assign a task and send it to another person and it stays in the other person email until he accepts it, i want to automatically accept the task for the user, i can't find an event which gets triggered
can anyone there help me please

i found this

This Microsoft Visual Basic/Visual Basic for Applications (VBA) example accepts a TaskRequestItem, sending the response without displaying the inspector.

Sub AcceptTask()
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myTasks As Outlook.MAPIFolder
Dim myNewTaskItem As Outlook.TaskItem
Dim mytaskreqItem As Outlook.TaskRequestItem
Dim myItem As Outlook.TaskItem
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myTasks = myNameSpace.GetDefaultFolder(olFolderInbox)
Set mytaskreqItem = myTasks.Items.Find("[Subject] = ""Meeting w/ Nate Sun""")
If Not TypeName(mytaskreqItem) = "Nothing" Then
Set myNewTaskItem = mytaskreqItem.GetAssociatedTask(True)
Set myItem = myNewTaskItem.Respond(olTaskAccept, True, True)
myItem.Send
End If
End Sub

however i think this one assumes that we know the subject name of the email that has the taskrequestitem is there's a way to go around that?
or even another totally different way @@?

thanks heaps