Skip to Content
CDO & MAPI Programming with Visual Basic:
book

CDO & MAPI Programming with Visual Basic:

by Dave Grundgeiger
October 2000
Intermediate to advanced
384 pages
10h 22m
English
O'Reilly Media, Inc.
Content preview from CDO & MAPI Programming with Visual Basic:

Creating a Task

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
COM Programming with Microsoft® .NET

COM Programming with Microsoft® .NET

John Paul Mueller, Julian Templeman

Publisher Resources

ISBN: 156592665XSupplemental ContentCatalog PageErrata