October 2000
Intermediate to advanced
384 pages
10h 22m
English
To create a
task, add a Message object to a folder’s Messages collection,
setting the Type property of the Message object to
"IPM.Task“. A task can be created in
any folder, but the most logical choice is the user’s Tasks
folder, as shown here:
' gCdoSession previously Dim'ed, Set, and logged on. Dim CdoFolder As MAPI.Folder Dim CdoMessages As MAPI.Messages Dim CdoMessage As MAPI.Message ' Get the Tasks folder. Set CdoFolder = gCdoSession.GetDefaultFolder(CdoDefaultFolderTasks) ' Get the collection of tasks. Set CdoMessages = CdoFolder.Messages ' Add a new task. Set CdoMessage = CdoMessages.Add(Subject:="Buy milk", Type:="IPM.Task") ' Save the new item. CdoMessage.Update
The body text can be set, if desired, by passing a string in the Text parameter of the Messages collection’s Add method, or by setting the Text property of the Message object itself.