title: C# windows search on mapped network drive
body: <p>I am trying to do a Windows Search on a mapped network drive from a c# .NET 3.5 web application. It works fine with a local drive.</p>
  
  <p>I can map the drive and I can add that mapped drive to a library, and do an interactive search successfully from the Start menu. It finds files and even finds text within files. The drive is indexed on the server.</p>
  
  <p>When I try to find a list of files for a folder within the mapped drive using code then nothing is returned. I am not sure what the folder needs to be in the search string as it is its presence within the library (Documents) that allows it to be searched.</p>
  
  <pre><code>System.Data.OleDb.OleDbConnection connection = new
  System.Data.OleDb.OleDbConnection();
  connection.ConnectionString = "provider=Search.CollatorDSO.1
  EXTENDED?PROPERTIES='Application=Windows'";
          connection.Open();
  string sqlString = @"SELECT System.ItemName FROM SystemIndex WHERE 
  System.ItemType &lt;&gt; 'Directory' AND DIRECTORY='File:Z:\\'";
  System.Data.OleDb.OleDbCommand cmd = new
  System.Data.OleDb.OleDbCommand(sqlString, connection);
  System.Data.OleDb.OleDbDataReader reader = null;
  reader = cmd.ExecuteReader();
  while (reader.Read())
  {
      ...
  }
  </code></pre>
  
  <p>Nothing is returned by the reader. The Z: drive is the mapped drive.</p>
  
  <p>I can't add the mapped drive in Program Manager > Indexing Options. It isn't listed.</p>