ContentSource.Delete メソッド (Microsoft.Office.Server.Search.Administration)
コンテンツ ソースを削除します。
名前空間: Microsoft.Office.Server.Search.Administration
アセンブリ: Microsoft.Office.Server.Search (microsoft.office.server.search.dll 内)
構文
'宣言
Public Sub Delete
'使用
Dim instance As ContentSource
instance.Delete
public void Delete ()
例
以下のコード例は、共有サービス プロバイダのコンテンツ ソース コレクションからコンテンツ ソースを削除します。このサンプル コードを実行する完全な手順については、「[方法] コンテンツ ソースを削除する」を参照してください。
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 DeleteContentSourceSample
{
class Program
{
static void Main(string[] args)
{
try
{
//Replace <SiteName> with the name of a site using the Shared Service Provider.
string strURL = "<SiteURL>";
Content sspContent = new Content(SearchContext.GetContext(new SPSite(strURL)));
ContentSourceCollection sspContentSources = sspContent.ContentSources;
//Replace <ContentSourceName> with the ID for the content source to delete.
string strCSName = "<ContentSourceName>";
ContentSource contentSource = sspContentSources[strCSName];
contentSource.Delete();
Console.WriteLine(strCSName + " deleted.");
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
}
関連項目
参照
ContentSource クラス
ContentSource メンバ
Microsoft.Office.Server.Search.Administration 名前空間
Content クラス
その他のリソース
エンタープライズ検索管理オブジェクト モデルを使うにあたって
コンテンツ ソースの概要
コンテンツを管理する
[方法] 共有サービス プロバイダのコンテンツ ソースを取得する
[方法] コンテンツ ソースを追加する
[方法] コンテンツ ソースを削除する
[方法] コンテンツ ソースのクロールをプログラム的に管理する
[方法] コンテンツ ソースのクロール スケジュールをプログラムで構成する