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

エンタープライズ検索 のすべてのコンテンツ ソースの基本クラスを提供します。

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

構文

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

備考

コンテンツ ソースおよび エンタープライズ検索 の新しい管理オブジェクト モデルの詳細については、「コンテンツ ソースの概要」および「Getting Started with the Search Administration Object Model」を参照してください。

共有サービス プロバイダ (SSP) のコンテンツ ソースのコレクションを取得するには、Content クラスの ContentSources プロパティを使用します。

コレクションに新しいコンテンツ ソースを追加するには、ContentSourceCollection クラスの Create メソッドを使用します。

コンテンツ ソースを削除するには、ContentSource クラスの Delete メソッドを使用します。

ContentSourceCollection オブジェクトから 1 つのコンテンツ ソースを返すには、インデクサを使用します。たとえば、コレクションが sspContentSources という名前の変数に割り当てられている場合、Microsoft Visual C# では sspContentSources[index]、または Microsoft Visual Basic では sspContentSources(index) を使用します。ここで index は、コンテンツ ソースの名前を含む文字列またはコンテンツ ソースの ID を含む整数です。

以下のコード例は、共有サービス プロバイダのコンテンツ ソースの完全なリストをコンソール ウィンドウに出力します。

Prerequisites

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

Project References

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

  • Microsoft.SharePoint

  • Microsoft.Office.Server

  • Microsoft.Office.Server.Search

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.SharePoint;

namespace ContentSourceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            Replace <SiteName> with the name of a site
            using the Shared Service Provider.
            */
            string strURL = "http://<SiteName>";
            SearchContext context;
            using(SPSite site = new SPSite(strURL))
            {
            context = SearchContext.GetContext(site);
            }
            Content sspContent = new Content(context);
            ContentSourceCollection sspContentSources = sspContent.ContentSources;
            foreach (ContentSource cs in sspContentSources)
            {
                Console.WriteLine("NAME: " + cs.Name + "  ID: " + cs.Id);
            }
        }
    }
}

継承階層

System.Object
  Microsoft.Office.Server.Search.Administration.ContentSource
     Microsoft.Office.Server.Search.Administration.BusinessDataContentSource
     Microsoft.Office.Server.Search.Administration.CustomContentSource
     Microsoft.Office.Server.Search.Administration.HierarchicalContentSource
     Microsoft.Office.Server.Search.Administration.SharePointContentSource
     Microsoft.Office.Server.Search.Administration.WebContentSource

スレッドの安全性

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

関連項目

参照

ContentSource メンバ
Microsoft.Office.Server.Search.Administration 名前空間
Content クラス

その他のリソース

エンタープライズ検索管理オブジェクト モデルを使うにあたって
コンテンツ ソースの概要
コンテンツを管理する
[方法] 共有サービス プロバイダのコンテンツ ソースを取得する
[方法] コンテンツ ソースを追加する
[方法] コンテンツ ソースを削除する
[方法] コンテンツ ソースのクロールをプログラム的に管理する
[方法] コンテンツ ソースのクロール スケジュールをプログラムで構成する