I have the following code, which I found in the Sandbox and have made some modifications to. It works great as it creates the ToDo Task but when I view the actual task that was created I do not see the participants. I have this same problem with creating an Invitation from Lotus Script - participants are not visible. I have reviewed the TODO form through designed to ensure that I was setting all the correct fields in order to get the participants to display, but I have no luck. Any suggestions would be appreciated.
CODE:
Function CreateTask(assignedTo As String, subject As String, startDate As String, dueDate As String, body As String, import As Variant, linkto As notesdocument, categoryText As String) As Integer
%REM
'This function creates a Notes TASK (ToDo) in the mail database
Parameters:
-
assignedTo - Type String. A person name.
-
subject - Type String. The task subject.
-
startDate - Type Variant. The starting date of the task.
-
dueDate - Type Variant. The completion date of the task.
-
body - Type String. The contents of the task body.
-
import - Type Variant. The importance of the task. 1=High, 2=Medium, 3=Low
-
linkto - Type NotesDocument. Used to create a doclink.
-
categoryText - Type String. The task category.
Example of Usage:
subject = "Custom Subject"
completion by " & doc.DueDate(0)
startdate = Today
duedate = Cdat(doc.DueDate(0))
assignedTo = doc.Champion(0)
body = "Custom Body" & Chr(10)
cat = "SIU"
–>> Call SendTask(assignedTo, subject, startdate, duedate, body, “1”, doc, cat)
%END REM
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim rtitem As NotesRichTextItem
Dim todoDoc As NotesDocument
Dim maildb As New NotesDatabase( "", "" )
Call maildb.OpenMail
Set todoDoc = New NotesDocument(maildb)
'Setup error handling
On Error Goto ErrorHandler
'Populate task fields
With todoDoc
.Form = "Task"
.Alarms = "1"
.Subject = subject
.StartDate = Cdat(startdate & " 12:01:00 PM")
.DueDate = Cdat(duedate & " 12:01:00 PM")
.DueDateTime = Cdat(duedate & " 12:01:00 PM")
.CalendarDateTime = Cdat(startdate & " 12:01:00 PM")
.Importance = import
.AssignedTo = assignedto
.tmpRequired = assignedto
.Chair = session.UserName
.CopyTo = ""
.Categories = categoryText
If assignedto = "" Then
.TaskType = "1"
Else
.TaskType = "2"
End If
.tmpAction = "6"
.tmpOwnerHW = "1"
’ .tmpNoActionBar = “1”
.tmpNoActionBar = ""
'.NoticeType = ""
.DUESTATE = 1
.PostedDate = Date
.~_ViewIcon = 8
End With
'Handle the rich text Body field and doclink
Set rtItem = todoDoc.CreateRichTextItem("Body")
Call rtItem.AddNewLine(2)
Call rtItem.AppendText(body)
If Not( linkto Is Nothing) Then
Call rtItem.AddNewLine(2)
Call rtItem.AppendText("Click link to open document -->")
Call rtItem.AppendDocLink(linkto, "Click link to open document")
End If
'Save the Task (ToDo) document
Call todoDoc.ComputeWithForm(False, False)
Call todoDoc.save(True, False)
'If (Msgbox("A new task was created and saved." & Chr(10) & "Would you like to edit this task now?", 36, "Action Item") = 6) Then
'Display the newly created task in edit mode
' Call ws.EditDocument(True, todoDoc)
'End If
'Return a success
SendTask=True
Exit Function
ErrorHandler:
Print ( "Error " & Str$(Err) & ": " & Error$ )
Resume TheEnd
TheEnd:
'Return a failure
SendTask = False
End Function