如何添加文件夹到Windows与Windows Search API的索引列表 [英] How to add folder into windows indexing list with windows search api

查看:484
本文介绍了如何添加文件夹到Windows与Windows Search API的索引列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在索引选项,还有的人指数这些位置位置列表,有没有办法添加从我的应用程序创建到列表中通过C#中的文件夹?

In Indexing Options, there’s a list of locations in ‘Index these locations’, is there a way to add a folder which created from my app into the list through c#?

推荐答案

我已经找到了解决办法,谁不想让自己的应用程序文件夹,支持C#Windows搜索可以做象下面这样:

I have found a solution, anyone who want to let their app folder to support windows search in C# can do like below:


  1. 下载的Windows Search API(的 http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=7388

导入Micosoft.Search.Interop命名空间。

Import Micosoft.Search.Interop namespace.

写代码

Uri path = new Uri(location);

string indexingPath = path.AbsoluteUri;

CSearchManager csm = new CSearchManager();
CSearchCrawlScopeManager manager = csm.GetCatalog("SystemIndex").GetCrawlScopeManager();
manager.AddUserScopeRule(indexingPath, 1, 1, 0);
manager.SaveAll();


这篇关于如何添加文件夹到Windows与Windows Search API的索引列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆