Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added an additional mailbox to my account. I want to create a view that is similar to the 'to do list' view that exists for that user. This means I want a search folder that searches that mailbox for objects of any type that have a follow up flag set or is a task.

You cannot do this from the UI. I found this:

Sub CreateNewSearchFolder()
   Set MyOutlookApplication = Outlook.Application
   SearchSubFolders = True
   Set MapiNamespace = Application.GetNamespace("MAPI")
   Set TasksFolder =     MapiNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks).Parent
   strS = "'" & TasksFolder.FolderPath & "'"

   'strS = "'\\Mailbox - Other'"
   Dim folderName As String
   folderName = InputBox("Name of new search folder?:", "Folder Name", "")
   Dim objSch As Search

   Dim taskFilter As String
   taskFilter = "(""""= 'Tasks' AND     ""{00062003-0000-0000-C000-000000000046}/81010003"" <>    2) OR (NOT(""×10900003"" IS NULL) AND ""{00062003-0000-0000-C000-000000000046}/81010003"" <> 2)"
   Dim strTag As String
   strTag = "RecurSearch"

   Dim fupFilter As String
   fupFilter = "(NOT(""urn:schemas:httpmail:messageflag"" IS NULL))"

   Set objSch = Application.AdvancedSearch(Scope:=strS, _
   Filter:=taskFilter & " OR " + fupFilter + "", _
  SearchSubFolders:=True, Tag:=strTag)
   objSch.Save (folderName)

    End Sub

This works perfectly - for my mailbox. That is, it creates a view similar to the to-do list view that I want. It has every object type with a follow up flag, and tasks. However, if i uncomment the strS = "'\\Mailbox - Other'" line and run it, Outlook crashes on the .Save() line.

Any advice?

share|improve this question
When Outlook cranes on the other Mailbox, is there any error message shown, or any more info that you could give us, about exactly what happens? – Clare Macrae Oct 26 '11 at 6:16
It crashes with an Access Violation (c0000005) at 0x000479ff while executing the .Save() line. – EB. Oct 26 '11 at 17:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.