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

ManagedProperty オブジェクトのコレクションを表します。

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

構文

'宣言
<DefaultMemberAttribute("Item")> _
<SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel:=True)> _
Public NotInheritable Class ManagedPropertyCollection
    Implements IEnumerable
'使用
Dim instance As ManagedPropertyCollection
[DefaultMemberAttribute("Item")] 
[SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel=true)] 
public sealed class ManagedPropertyCollection : IEnumerable

備考

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

新しい管理プロパティをコレクションに追加するには、Create メソッドを使用します。

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

以下のコード例は、コンソール ウィンドウに管理プロパティの完全なリストを出力します。このサンプル コードを実行する完全な手順については、「[方法] 共有サービス プロバイダの管理プロパティを取得する」を参照してください。

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 ManagedPropertiesSample
{
    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)));
                ManagedPropertyCollection properties = sspSchema.AllManagedProperties;
                foreach (ManagedProperty property in properties)
                {
                    Console.WriteLine(property.Name);
                }
            }
            catch(Exception ex)
            {
                 Console.WriteLine(ex.ToString());
            }
        }
    }
}

継承階層

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

スレッドの安全性

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

関連項目

参照

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