Category クラス (Microsoft.Office.Server.Search.Administration)

エンタープライズ検索 メタデータ プロパティ スキーマのカテゴリを表します。

名前空間: Microsoft.Office.Server.Search.Administration
アセンブリ: Microsoft.Office.Server.Search (microsoft.office.server.search.dll 内)

構文

'宣言
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
Public NotInheritable Class Category
'使用
Dim instance As Category
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
public sealed class Category

備考

エンタープライズ検索 スキーマでは、クロールされたプロパティは使用されるプロトコル ハンドラを表すさまざまなカテゴリにグループ化されます。クロールされたプロパティの詳細については、「メタデータを管理する」を参照してください。

共有サービス プロバイダの検索スキーマにあるプロパティ カテゴリのコレクションを取得するには、Schema クラスの AllCategories プロパティを使用します。

CategoryCollection オブジェクトから 1 つの管理プロパティを返すには、インデクサを使用します。

たとえば、コレクションが categories という名前の変数に割り当てられている場合、Microsoft Visual C# では categories[index]、または Microsoft Visual Basic では categories(index) を使用します。ここで index は、カテゴリの名前を含む文字列またはカテゴリのプロパティ セットを識別する GUID です。

以下のコード例は、コンソール ウィンドウにカテゴリの完全なリストを出力します。

Prerequisites

共有サービス プロバイダが既に作成されていることを確認します。

Project References

このサンプルを実行する前に、コンソール アプリケーション コード プロジェクトに以下のプロジェクト参照を追加します。

  • Microsoft.SharePoint

  • Microsoft.Office.Server

  • Microsoft.Office.Server.Search

using System;
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.SharePoint;
namespace CategoriesSample
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                //Replace <SiteName> with the name of a site using the Shared Service Provider
                string strURL = "http://<SiteName>";
                Schema sspSchema = new Schema(SearchContext.GetContext(new SPSite(strURL)));
                CategoryCollection categories = sspSchema.AllCategories;
                foreach (Category category in categories)
                {
                    Console.WriteLine(category.Name);
                }
            }
            catch(Exception ex)
            {
                 Console.WriteLine(ex.ToString());
            }
        }
    }
}

継承階層

System.Object
  Microsoft.Office.Server.Search.Administration.Category

スレッドの安全性

この型のパブリックで静的な (Visual Basic では Shared) すべてのメンバは、スレッド セーフです。インスタンス メンバは、スレッド セーフであるとは保証されません。

関連項目

参照

Category メンバ
Microsoft.Office.Server.Search.Administration 名前空間