Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Task with MAPI session is saved as a message

Status
Not open for further replies.

checkOut

Technical User
Oct 17, 2002
153
NL
The code below saves the item in the task folder from outlook but it's just a message and not a task! Do anyone know what's wrong with this code?

Public Function fctnOutlookTask()
Dim objTask As MAPI.Message 'All item types are called Messages in CDO
Dim objTasks As MAPI.Messages
Dim objSession As MAPI.Session
Dim objFolder As MAPI.Folder
Dim strProfile As String, objFields

Set objSession = CreateObject("MAPI.Session")

strProfile = "<server>" & vbLf & "<account"
objSession.Logon , , , False, , True, strProfile
'Get the tasks folder
Set objFolder = objSession.GetDefaultFolder(CdoDefaultFolderTasks)
'Get the task items collection
Set objTasks = objFolder.Messages
'Can use the Add method here to add a new task
Set objTask = objTasks.Add
Set objFields = objTask.Fields
objFields.Add CdoPR_BODY, "taak 1"
strLContact = "Gerard Krijgsman" 'Assign Contact Name.

objFields.Add CdoTask_Contacts, 8, Trim(strLContact), CdoPropSetID4
objFields.Add CdoTask_DueDate, 8, #7/5/2004#, CdoPropSetID2
objFields.Add CdoTask_PercentComplete, 8, 0, CdoPropSetID2
objTask.Subject = "Dit is een taak"
objTask.Update

Set objTask = Nothing
Set objTasks = Nothing
Set objFolder = Nothing
Set objSession = Nothing
End Function

The DueDate also doesn't work.

Many thanx in advance

Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top