Use Item.Add Event to Trigger TaskItem.Assign?

K

Kathy Drungilas

I need to create a VBA function to take an incoming task (using tasks folder
Item.Add event) and assign it to the recipient in a custom field
(olTaskItem.Implementer). I've seen code snippets here and there in the
past, but now that I need help, I can't find examples. The tasks are being
placed into default task folder by another application synchronizing with
Outlook.

I'm using Redemption with Outlook 2002.

Kathy Drungilas--
to answer via email, remove [nospam] from address
 
K

Kathy Drungilas

My code to-date is as follows. I do not get any errors, but it seems that
nothing happens. Those who should be assigned the task are not receiving
anything. Any assistance out there?

Sub AssignEnvironmentalTask()



Dim objApp As Outlook.Application

Dim objNS As NameSpace

Dim objMe As SafeCurrentUser 'Redemption object

Dim plantTasks As MAPIFolder

Dim plantTask As TaskItem



'reference the mailbox folder to work with

Set objNS = Application.GetNamespace("MAPI")

Set objMe = CreateObject("Redemption.SafeCurrentUser")

Set plantTasks = objNS.GetDefaultFolder(olFolderTasks)



'Loop through all Tasks in Tasks Folder

For Each plantTask In plantTasks.Items

If plantTask.UnRead = True Then

If plantTask.UserProperties("Implementer") <> Null Then

With plantTask

.AssignRecipient = plantTask.Implementer

.Save

.Send

.UnRead = False

End With

End If

End If

Next



Set plantTask = Nothing

Set plantTasks = Nothing

Set objNS = Nothing



End Sub



Kathy Drungilas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top