Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:05:47+00:00 2026-05-28T03:05:47+00:00

Is there a way to call SearchIndexer with arguments? (or is there another way

  • 0

Is there a way to call SearchIndexer with arguments? (or is there another way to accomplish what the title says?)

I tried looking at the various MSDN articles, but they all seemed to suggest that I use a library. But when I run the search, it runs, without me downloading any sort of library.

Back in the days of XP, you could go to the indexing service properties and execute a query. I don’t see that in Windows 7.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:05:48+00:00Added an answer on May 28, 2026 at 3:05 am

    Here’s an example query. Note that it does not use the Windows 7 SDK.

    using System;
    using System.Data.OleDb;
    
    namespace FileSearchingExe
    {
    class MainProgram
    {
        static void Main(string[] args)
        {     
    string sqlQuery = "SELECT TOP 10 \"System.ItemPathDisplay\", \"System.DateModified\" FROM \"SystemIndex\" WHERE CONTAINS(*,'\"urSearchWord*\"') " +
                "AND scope='file:C:/SomeFolder' ORDER BY System.ItemPathDisplay DESC"; //note the forwardslash in the scope parameter.
    
            // --- Perform the query ---
            // create an OleDbConnection object which connects to the indexer provider with the windows application
            using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection("provider=Search.CollatorDSO.1;EXTENDED PROPERTIES=\"Application=Windows\""))//queryHelper.ConnectionString))
            {
                // open the connection
                conn.Open();
    
                // now create an OleDB command object with the query we built above and the connection we just opened.
                using (OleDbCommand command = new OleDbCommand(sqlQuery, conn))
                {
                    // execute the command, which returns the results as an OleDbDataReader.
                    using (OleDbDataReader WDSResults = command.ExecuteReader())
                    {
                        while (WDSResults.Read())
                        {
                            // col 0 is our path in display format
    
                            Console.WriteLine("{0}, {1}", WDSResults.GetString(0), WDSResults.GetDateTime(1).ToString());
                        }
                    }
                }
            }
         }
     }
     }
    

    However, it was adapted from the DSearch example in the Windows 7 SDK. ([SDK]\Samples\winui\WindowsSearch\DSearch. [SDK] is typically “C:\Program Files\Microsoft SDKs\Windows\v7.1”

    Note that you can make the SQL query more easily (but slightly less flexible imo) if you use the SDK’s ISearchQueryHelper. To use that class and related classes though, you need have reference to Microsoft.Search.Interop, which is not included in the Windows 7 SDK as a dll. You can however get it in dll form by using TlbImp.exe (type library importer, in [SDK]\bin) on the SearchAPI.tlb file (in [SDK]\Lib). Also described here.

    I hope this post helps anyone else who needs to programmatically connect to the Windows Search in Windows 7 or higher.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to call a method in one class from another class.
*Is there a way to call a function defined inside another function in javaSCRIPT?
Is there a way to call the method of a class from another class?
the title exactly -- is there a way to call an r process from
Is there a way to call another testcase inside a testcase? test simple do
Is there any way to call an action script function from an anchor which
Is there a way to call send / recv passing in a vector ?
is there a way to call java me application out of Symbian's C++ app?
Is there any way to call a php class (eg. $var = new className)
is there any way to call servlet or make a gwt-rpc call from gwt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.