none
Adding a Search Folder with Addin enabled takes a really long time. RRS feed

  • Question

  • Hello all,

    Using Outlook 2007 and 2010.

    We have an Addin that adds the pst to outlook and creates a bunch of folders.

    With our Addin enabled, if I add simple "unread email" search folder it takes minutes before Outlook responds, if it even responds. If I disable out Addin, the response time is in seconds.

    It is usually the first search folder that takes the longest time. If I kill outlook and restart it, the search folder is there and adding additional search folders is very quick.

    What am I missing ?


    Mohammad Faridi.

    Monday, June 4, 2012 8:45 PM

Answers

  • Have you tried to comment out most of your add-in's code and then bring it back a few lines at a time to figure out which part of your code causes this problem?


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

    Monday, June 4, 2012 8:52 PM

All replies

  • Have you tried to comment out most of your add-in's code and then bring it back a few lines at a time to figure out which part of your code causes this problem?


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

    Monday, June 4, 2012 8:52 PM
  • There is a lot of code to comment out :)

    I will try it, and see if there is anything that pops up.


    Mohammad Faridi.

    Monday, June 4, 2012 8:59 PM
  • Thanks for the suggestion. I found the culprit in the ViewSwith event, I was running out of memory looping through parents.

    Is there any property to tell me that this is a search folder ?

    Currently we are doing a lot of custom context menu's, and syncing if the folders that are created are folders that we created, but since Search Folders are a given in a PST, and we can't get rid of them, I would like to figure out how to skip processing on Search Folders.

    I think the Search Folders don't exist until you create a new custom search, is that correct ?

    Thoughts ?


    Mohammad Faridi.

    Tuesday, June 5, 2012 4:45 PM
  • I see that the Store has a  GetSearchFolders() method. that should work

    Mohammad Faridi.

    Tuesday, June 5, 2012 5:42 PM
  • You can read the PR_FOLDER_TYPE property (http://schemas.microsoft.com/mapi/proptag/0x36010003) using Folder.PropertyAccessor

    Search folders will be FOLDER_SEARCH (2).


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

    Tuesday, June 5, 2012 5:46 PM
  • Are you saying this will return me something ?  Even if there are no Searches created yet ?

    var pa1 = store.PropertyAccessor;
                    var x = pa1.BinaryToString(pa1.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x36010003"));

    Thanks


    Mohammad Faridi.

    Tuesday, June 5, 2012 8:48 PM
  • No, that property is available on a folder, not a store.

    I thought you are trying to figure out whether a given folder is a regular folder or a search folder?


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

    Tuesday, June 5, 2012 8:58 PM
  • You are correct.  my bad.


    Mohammad Faridi.

    Tuesday, June 5, 2012 9:13 PM