locked
Determine whether Current Folder is Search Folder or not. RRS feed

  • Question

  • Hi,

    I have a requirement to identify the Current Folder is a Search Folder or not.

    Am able to get hold of current folder with following piece of code:

    CComPtr<Outlook::_Explorer> spExplorer;
    Outlook::MAPIFolder * pFolder;
    CComPtr<Outlook::View> view;
    hr = m_pHostApp->ActiveExplorer(&spExplorer);   
    if (SUCCEEDED(hr) && spExplorer)
    {
        hr =  spExplorer->get_CurrentFolder(&pFolder);
        if ((SUCCEEDED(hr)) && pFolder)
        {

    Now, I want to determine whether current folder is "Search Folder" or not.

    I couldn't find any property on MAPIFolder for the same.

    Kindly, help me out.


    Sachin R. Chavan.

    Friday, July 29, 2016 1:38 PM

Answers

  • Hello Sachin,

    I'd recommend using any low-level property viewer tool such as MFCMAPI or OutlookSpy. In that case you can see a number of available properties and their values. And find the exact property which shows the difference.

    The PR_FOLDER_TYPE (0x36010003) property can help in that case. The DASL name is http://schemas.microsoft.com/mapi/proptag/0x36010003 , you just need to pass it to the GetProperty method of the PropertyAccessor class (see the corresponding property of the Folder class).


    [custom.development]

    Friday, July 29, 2016 2:59 PM
  • Thanks,

    That's answers my question.

    Also, it will be good if you can add link to some code sample.

    Regards,

    Sachin R. Chavan.


    Sachin R. Chavan.

    Sunday, July 31, 2016 1:14 PM

All replies

  • Hello Sachin,

    Use Property Accessor to retrieve folder property "PR_FOLDER_TYPE". For search folder the value will be 2 ("FOLDER_SEARCH"). You may find more information over there: PidTagFolderType Canonical Property 

    Hope this helps


    Slava Ivanov

    Friday, July 29, 2016 2:50 PM
  • Hello Sachin,

    I'd recommend using any low-level property viewer tool such as MFCMAPI or OutlookSpy. In that case you can see a number of available properties and their values. And find the exact property which shows the difference.

    The PR_FOLDER_TYPE (0x36010003) property can help in that case. The DASL name is http://schemas.microsoft.com/mapi/proptag/0x36010003 , you just need to pass it to the GetProperty method of the PropertyAccessor class (see the corresponding property of the Folder class).


    [custom.development]

    Friday, July 29, 2016 2:59 PM
  • Thanks,

    That's answers my question.

    Also, it will be good if you can add link to some code sample.

    Regards,

    Sachin R. Chavan.


    Sachin R. Chavan.

    Sunday, July 31, 2016 1:14 PM