I am trying to create Outlook tasks in a VB app, assign them to various team
members, and have the status of the tasks reflected in my task list.
My code is below. It reads the information from a database and creates the
tasks just fine. But it sends two e-mails for every task, a 'Request' and an
'Update', and if I status a task from a receiver, the results are not
reflected in my Task view. I know it has to do with the various types of
recipient, but I have't been able to pin it down. Can you help?
Set appOut = CreateObject("Outlook.Application")
Adodc1.RecordSource = "Select * from Steps Where ProcessID='" &
txtFields(0).Text & "'"
Adodc1.Refresh
Dim Counter As Integer
Counter = 0
Do While Not Adodc1.Recordset.EOF
Set tsksOut = appOut.CreateItem(olTaskItem)
tsksOut.Recipients.Add (Adodc1.Recordset.Fields("AssignedTo_EMail"))
'recipient's email address
tsksOut.Recipients(1).Type = 2
tsksOut.Recipients.Add (txtFields(3).Text)
tsksOut.Recipients(2).Type = 3
tsksOut.Subject = Adodc1.Recordset.Fields("Step_Name") & " -
Assignment for process " & txtFields(1).Text & " from " & txtFields(3).Text
tsksOut.Body = "Step Name: " & Adodc1.Recordset.Fields("Step_Name")
& Chr(10) & "Description: " & Adodc1.Recordset.Fields("Step_Description") &
Chr(10) & "Instructions: " & Adodc1.Recordset.Fields("Instructions")
tsksOut.DueDate = CDate(txtFields(10).Text)
tsksOut.Owner = txtFields(3).Text ' this text box holds the sender's
e-mail
tsksOut.SchedulePlusPriority = "High"
tsksOut.StatusOnCompletionRecipients = txtFields(11).Text 'this text
box holds the sender's e-mail address
tsksOut.StatusUpdateRecipients = txtFields(11).Text 'this text box
holds the sender's e-mail address
tsksOut.TeamTask = True
tsksOut.Recipients.ResolveAll
tsksOut.Assign
tsksOut.Send
tsksOut.Save
Adodc1.Recordset.MoveNext
Counter = Counter + 1
Loop
I would appreciate any help you could offer. Thank you very much.
Rick Williams
http://www.scramsoftware.vallnet.com