none
Hide a Outlook folder & its emails from appearing in Outlook Search RRS feed

  • Question


  • 1. Is there a way to hide a Outlook folder and its emails from appearing in the search results while searching for emails using the Outlook search?

    2. Is there a user property of the email or the folder that can be used to hide the email from the Outlook search results?

    Monday, September 12, 2016 9:54 PM

Answers

  • Hello,

    1. Nope. The Outlook object model doesn't provide anything for excluding folders and emails from appearing in the search results. You can try to keep your content as hidden items, but this approach will not work under some conditions. GetStorage returns an error if the store type of the folder is not supported. The following stores return an error when GetStorage is called:

    • Hotmail store

    • Internet Message Access Protocol (IMAP) stores

    • Delegate stores

    • Public folder stores

    2. Nope. In general, I'd suggest keeping settings out of the IPM folder tree. For example, you can create a folder at the store level which is not visible in the Outlook UI. Or just save your data to any file on the disk.


    [custom.development]

    • Marked as answer by DC787 Wednesday, September 14, 2016 10:10 PM
    Wednesday, September 14, 2016 5:53 PM

All replies

  • Is this a programming question? If you create a search programmatically, you can always exclude a message by specifying its entry id. Or a parent folder entry id if you don't want the whole folder.  

    That is how Outlook excludes Deleted Items and Junk Mail folders.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!


    Monday, September 12, 2016 11:36 PM
  • Hi Dmitry,

     

    Thank you for replying.

     

    Yes this is a programming question.

     

    I was trying to build a Outlook software which stored its settings in some emails in a folder in Outlook.

    Problem: When the user search for a particular term on the Outlook Search,  the users are able to view these setting emails on the Outlook search results and sometimes delete these setting emails accidentally.

    I was hoping for a way to update the user property of the email or the folder to hide this from the Outlook search results, so that the users do not accidentally delete these settings. I have managed to hide a folder using the Property: http://schemas.microsoft.com/mapi/proptag/0x10F4000B, but its emails are shown on the Outlook search result.

    By changing the property to hide the folder, I was able to code this in with ease, this helped me as I did not have to change any of the other users folders or settings but only my own programs.

    Is there a user property that I can use on the folder or the email to achieve this?


    • Edited by DC787 Tuesday, September 13, 2016 2:20 AM
    Tuesday, September 13, 2016 2:18 AM
  • The settings need to be stored in the hidden (associated) contents table of a folder. These messages are accessible using MAPIFolder.GetStorage. You can see existing hidden messages in OutlookSpy (click IMAPIFolder | "Associated Contents" tab)

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, September 13, 2016 3:30 AM
  • Hello,

    1. Nope. The Outlook object model doesn't provide anything for excluding folders and emails from appearing in the search results. You can try to keep your content as hidden items, but this approach will not work under some conditions. GetStorage returns an error if the store type of the folder is not supported. The following stores return an error when GetStorage is called:

    • Hotmail store

    • Internet Message Access Protocol (IMAP) stores

    • Delegate stores

    • Public folder stores

    2. Nope. In general, I'd suggest keeping settings out of the IPM folder tree. For example, you can create a folder at the store level which is not visible in the Outlook UI. Or just save your data to any file on the disk.


    [custom.development]

    • Marked as answer by DC787 Wednesday, September 14, 2016 10:10 PM
    Wednesday, September 14, 2016 5:53 PM
  • Thanks guys for providing valuable information about this.
    Wednesday, September 14, 2016 10:12 PM