This Outlook VBA code loops through all the folders and debugs their names.
I can get the default folder for tasks
Set ObjTaskFolder = ObjNS.GetDefaultFolder(olFolderTasks)
I have two task folders and I need all the items (Tasks) within these folders.
I don't want to check all the folder items with .class=oltask
so I am looking for a way to evaluate at folder level.
Set ObjNS = Application.GetNamespace("MAPI")
For f = 1 To ObjNS.Folders(1).Folders.Count
Debug.Print ObjNS.Folders(1).Folders(f)
If (ObjNS.Folders(1).Folders(f).Class = olTask) Then
'Task folder
End If
Next f
I am looking for a way to evaluate folders, for the task folder only and then loop through all the items in within?
CodePudding user response:
Check that the MAPIFolder.DefaultItemType
property is OlItemType.olTaskItem
(=3
) or the MAPIFolder.DefaultMessageClass
property is "IPM.Task"
.