none
Need DASL filter for Outlook.Applicaiton.AdvancedSearch() method to search Sender, Recipient, Subject and Mailbody RRS feed

  • Question

  • Hi all,

    All I would like to do is search in "all" fields of mailitems, that is Sender, Recipient, Subject and Mailbody.

    The search needs to be done on hundreds of keywords and therefore the need to automate this (automating OL2007 and 2010). 

    From the help on the AdvancedSearch() method I have "urn:schemas:mailheader:subject = 'Test'" as a starter and also found some pointers on DASL syntax in general. But before I dive into this, could you please give a simple example searching in all the above mentioned fields?

    Thanks, Olaf.

    • Changed type Olaf Doschke Wednesday, April 27, 2011 10:20 AM
    Wednesday, April 27, 2011 6:13 AM

Answers

  • There is no such thing as a simple example for that. There are many fields that cannot be searched that way such as any binary or array property. In addition, any information in sub-tables such as Recipients or Attachments cannot be searched that way either.
     
    For the DASL properties I would recommend using a MAPI viewer such as MFCMAPI from MS or OutlookSpy (www.dimastr.com/outspy) to look at properties on mail items. That would show you exactly what properties are available to you and what the DASL tag is for each property.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Olaf Doschke" <=?utf-8?B?T2xhZiBEb3NjaGtl?=> wrote in message news:93132df7-5f98-4911-857a-b81bfe5dd2b1...

    Hi all,

    All I would like to do is search in "all" fields of mailitems, that is Sender, Recipient, Subject and Mailbody.

    The search needs to be done on hundreds of keywords and therefore the need to automate this (automating OL2007 and 2010). 

    From the help on the AdvancedSearch() method I have "urn:schemas:mailheader:subject = 'Test'" as a starter and also found some pointers on DASL syntax in general. But before I dive into this, could you please give a simple example searching in all the above mentioned fields?

    Thanks, Olaf.


    Ken Slovak MVP - Outlook
    • Marked as answer by Bruce Song Monday, May 9, 2011 8:59 AM
    Wednesday, April 27, 2011 1:25 PM
  • Hi Olaf,

    not sure if that would help,

    but another possible Option to do what you want is to enable Window Desktop Search and use the Windows Search API

    http://www.microsoft.com/windows/products/winfamily/desktopsearch/choose/windowssearch4/developers.mspx

    This searches also Documents on the System.

    - or

    Integrate your own search using a searchengine like lucene.net and index your Outlook Items by yourself.

    http://incubator.apache.org/lucene.net/
    But that's not a simple task and lot's of work...

    Or see if the Lookeen Product may do what you want...

    http://www.lookeen.net/

    Hope this helps,

    greets - Helmut

     


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    • Marked as answer by Bruce Song Monday, May 9, 2011 8:59 AM
    Wednesday, April 27, 2011 1:41 PM
    Answerer

All replies

  • There is no such thing as a simple example for that. There are many fields that cannot be searched that way such as any binary or array property. In addition, any information in sub-tables such as Recipients or Attachments cannot be searched that way either.
     
    For the DASL properties I would recommend using a MAPI viewer such as MFCMAPI from MS or OutlookSpy (www.dimastr.com/outspy) to look at properties on mail items. That would show you exactly what properties are available to you and what the DASL tag is for each property.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Olaf Doschke" <=?utf-8?B?T2xhZiBEb3NjaGtl?=> wrote in message news:93132df7-5f98-4911-857a-b81bfe5dd2b1...

    Hi all,

    All I would like to do is search in "all" fields of mailitems, that is Sender, Recipient, Subject and Mailbody.

    The search needs to be done on hundreds of keywords and therefore the need to automate this (automating OL2007 and 2010). 

    From the help on the AdvancedSearch() method I have "urn:schemas:mailheader:subject = 'Test'" as a starter and also found some pointers on DASL syntax in general. But before I dive into this, could you please give a simple example searching in all the above mentioned fields?

    Thanks, Olaf.


    Ken Slovak MVP - Outlook
    • Marked as answer by Bruce Song Monday, May 9, 2011 8:59 AM
    Wednesday, April 27, 2011 1:25 PM
  • Hi Olaf,

    not sure if that would help,

    but another possible Option to do what you want is to enable Window Desktop Search and use the Windows Search API

    http://www.microsoft.com/windows/products/winfamily/desktopsearch/choose/windowssearch4/developers.mspx

    This searches also Documents on the System.

    - or

    Integrate your own search using a searchengine like lucene.net and index your Outlook Items by yourself.

    http://incubator.apache.org/lucene.net/
    But that's not a simple task and lot's of work...

    Or see if the Lookeen Product may do what you want...

    http://www.lookeen.net/

    Hope this helps,

    greets - Helmut

     


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    • Marked as answer by Bruce Song Monday, May 9, 2011 8:59 AM
    Wednesday, April 27, 2011 1:41 PM
    Answerer
  • Thanks, Ken and Helmut,

    Ken, as you say there is no way to search in Recipient names or mail adresses via DASL that turns out to be the wrong direction. Thanks anyway to pointing me to MFCMAPI and OutlookSpy.

    Helmut, I just recently utilized Windows Search to search in PDFs and should have thought of that by myself, I'll look into that in detail and later report back how it turns out for me.

    Bye, Olaf.

    Wednesday, April 27, 2011 4:41 PM
  • Hi Olaf,

    Have you resolved your issue yet, and do the suggestions help you? If you have any concern on the thread, feel free to follow up.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 2, 2011 7:46 AM
  • Hello Bruce,

    I said I'll report back later. It took some time to evaluate recommended third party tools. Turns out windows search works sufficiently.

    Let me show a sample search which may help others using the windows search approach:

    Select System.ItemUrl, System.Search.AutoSummary from SystemIndex
    Where CONTAINS("System.Message.FromAddress",'@t-online') AND CONTAINS('*searchterm*')
    This is executed via Execute() method of an oledb.connection, which is connecting to "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
    That's just a starter for more complex searches.
    Bye, Olaf.
    Sunday, May 22, 2011 1:30 PM