Getting a list of excluded extensions for windows search (SystemIndex)

77 Views Asked by At

I want to retrieve a list of the extensions excluded from search indexing. Tried this

using Microsoft.Search.Interop;

CSearchManager csm=new CSearchManager();
ISearchCatalogManager iscm = csm.GetCatalog("SystemIndex")
Microsoft.Search.Interop.IEnumString ies = iscm.EnumerateExcludedExtensions();

but it turns out EnumerateExcludedExtensions is not implemented.

Anyone one know of an alternate route?

Thanks

1

There are 1 best solutions below

0
Phil G On

The following does work, retrieving the excluded extensions with the marked get/set-able bool IExtensions.IncludedExtensions at the apparently false-by-default value.

Curious to see that attempting to set that bool to true to get the included extensions instead gens an accessdenied error, and further running as admin, a notimplemented error. I could not find actual documentation.

This worked on Win 7 and Win 10 in my testing, but will have to ship in a try block regardless of course, and if it breaks down the line, not critical in my case, just becomes a missing feature.

using MSSCTLB; // C:\Windows\System32\mssrch.dll "Microsoft Search CoClasses Type Library"

CGatheringManager gm=new CGatheringManager();
IExtensions iexs = gm.GatherApplications["Windows"].GatherProjects["SystemIndex"].Gather.Extensions;


foreach (IExtension item in iexs)  listBox1.Items.Add(item.Extension);

also, the extended interfaces can be seen in MSSITLB, "Microsoft Search Interface Type Library" "C:\Windows\System32\mssitlb.dll"