jxli

导航

SharePoint可以全文爬网的文件类型

要获取MOSS的全文爬网类型,进入管理中心,点击进入搜索服务,链接地址如下:

http://sps2010:9000/searchadministration.aspx?appid=60245e13-6af0-4a51-8052-b036ea0a6849

拷贝"appid=”后面的部分,与代码中的GUID对应,代码如下,这样就会读取到可被全文爬网的文档类型

Guid searchApplicationId = new Guid("60245e13-6af0-4a51-8052-b036ea0a6849");
                    bool cached = false;
                    SearchServiceApplication serviceApplication = SearchService.Service.SearchApplications.GetValue<SearchServiceApplication>(searchApplicationId);
                    if ((SPPersistedObject)serviceApplication != (SPPersistedObject)null && !cached)
                        serviceApplication = serviceApplication.Clone() as SearchServiceApplication;
                    Microsoft.Office.Server.Search.Administration.Content content = new Microsoft.Office.Server.Search.Administration.Content(serviceApplication);
               

                    List<string> list = new List<string>();
                    foreach (Extension extension in content.ExtensionList)
                        list.Add(extension.FileExtension);
                    string[] array = list.ToArray();
                    Array.Sort<string>(array);
                    DataTable dataTable = new DataTable();
                    dataTable.Locale = CultureInfo.InvariantCulture;
                    dataTable.Columns.Add(new DataColumn("Extension"));
                  
                    foreach (string str in array)
                    {
                        DataRow row = dataTable.NewRow();
                        row["Extension"] = (object)str;
                      
                        dataTable.Rows.Add(row);
                    }
                    this.gridView.DataSource = (object)dataTable;
                    this.gridView.DataBind();

 

posted on 2012-09-07 20:03  jxli  阅读(239)  评论(0编辑  收藏  举报