Delete Outlook Task in code

Freshman

Registered User.
Local time
Today, 21:30
Joined
May 21, 2010
Messages
437
Hi all,

I find it easy enough to create an Outlook Task in code, but
how do I go about deleting an Outlook Task (based on criteria) in code?
(Google did not help much)

Thanks
 
Hi JR,
Thanks for the link - looks intresting - will have to play around to see how it works
Thanks
 
I tried this code but not working:

Public Function DelTasks()
Dim oOutlook As Outlook.Application
Dim Itm As Outlook.TaskItem
Set oOutlook = CreateObject("outlook.application")
Set Itm = oOutlook.CreateItem(olTaskItem)
Set oNameSpace = oOutlook.GetNamespace("MAPI")
Set oDefaultFolder = oNameSpace.GetDefaultFolder(olFolderTasks)
For Each Itm In oDefaultFolder
Itm.Delete
Next
End Function
 
The idea of creating anything in outlook is to add your own ID to a field when creating it, then to delete it you search for this ID. Do a search in the forum for my name you will find a number of examples probably with the calendar but the concept is the same. Search for the word mileage as I use this field.
 
Thanks a lot I did come right. And thanks for the tips yes - I do use the category and the person's staff number to make sure I only delete the relevant tasks.
 

Users who are viewing this thread

Back
Top Bottom