How to filter the Tasks Home Page???

G

Guest

Hi,
I want to filter the Tasks home page based on some input criteria like
From This Start Date to That Date.
I found a way that by using Restrict() Method in OlTaskItem Object,we can
filter the data and it does.
But the problem for me is that i can't able to place the Filtered collection
Object in the Tasks Home page.
Either i can able to Open all the Filtered Tasks using Display Method or i
can use Delete Method to delete the he collection object and something else i
can do.
But my requirement is to just show only the filtered Task in the TAsks
Home PAge.
Can anyone help with this?
 
M

Michael Bauer [MVP - Outlook]

G

Guest

Hi Bauer,
Thanks for your response.But i need to give the input dynamically,based
on the input given by the User,Tasks should be filtered.Further this has be
done by my application(my VBA code) and not by the Outlook predefined Tasks
filter.

Here is my sample code.
Const olFolderTasks = 13

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderTasks)
Set objTask = objOutlook.CreateItem(olTaskItem)

Set colItems = objFolder.Items

strFilter = "[Subject] = 'qwe'"
Set coltasks = colItems.Restrict(strFilter)

For Each objTask In coltasks
objTask.Display
Next

Here instead of "objTask.Display" ,i need some other thing that should show
only the filtered Tasks.Since "objTask.Display" will "open" all the filtered
Tasks. I don't want to open the Tasks but to show the Tasks.
 
M

Michael Bauer [MVP - Outlook]

You have two options:

1) The Restrict method returns a filtered Items collection. With a UserForm
and a Listbox on it you can display the items.

2) Modifiy the CurrentView.Xml property. Outlook will show the result
directly itself.


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - The most effective way to assign Outlook categories:
http://www.shareit.com/product.html?productid=300120654&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Thu, 15 Mar 2007 22:33:00 -0700 schrieb Charan:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top