Jack565595

After I added a directory to index location through the "desktop search tool", the directory appeared in the index location. But when I use the following code, it can't enumerate the newly added directory.

while ( SUCCEEDED(hr) )
{
CComPtr<ISearchRoot> spSearchRoot;
if ( S_OK != ( spEnumSearchRoots->Next(1, &spSearchRoot, NULL) ) )
break;

LPWSTR szUrl = NULL;
hr = spSearchRoot->get_RootURL( &szUrl );
ATLASSERT( SUCCEEDED(hr) );
m_view.AddString( szUrl );
CoTaskMemFree( szUrl );
}



Re: Windows Desktop Search Development Can't enumerate the root?

Eric Wolz - MSFT

Can you describe what you mean by "desktop search tool"




Re: Windows Desktop Search Development Can't enumerate the root?

Gerald Haslhofer

You need to differentiate between search roots and scope rules. I think what you are looking for is ISearchCrawlscopeManager::EnumerateScopeRules (instead of EnumerateRoots). When you add / remove scopes through the control panel or the API (AddUserScopeRule), you will not see any changes in the search roots.

Gerald