Schema 类 (Microsoft.Office.Server.Search.Administration)
Provides access to the property metadata management system for 企业级搜索.
命名空间: Microsoft.Office.Server.Search.Administration
程序集: Microsoft.Office.Server.Search (在 microsoft.office.server.search.dll 中)
语法
声明
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
Public NotInheritable Class Schema
用法
Dim instance As Schema
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)]
public sealed class Schema
备注
The Schema class is the entry point for managing the 企业级搜索 metadata schema for a Shared Service Provider's search service. To use the Schema object, you must do the following:
Add references to your application for the following dlls:
Microsoft.SharePoint.dll
Microsoft.Office.Server.dll
Microsoft.Office.Server.Search.dll
Specify the Shared Service Provider for the search service using the SearchContext object. For more information about ways to retrieve the search context, see 如何:返回搜索服务提供程序的搜索上下文.
The following topics contain code samples demonstrating how to use the Schema object model to perform various metadata management tasks programmatically:
示例
The following code example writes out the full list of managed properties to the console window. For a complete, step-by-step walkthrough of this sample code, see 如何:检索共享服务提供程序的托管属性.
Prerequisites
Ensure a Shared Service Provider is already created.
Project References
Add the following Project References in your console application code project before running this sample:
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.Schema
线程安全性
此类型的任何公共静态(在 Visual Basic 中共享)成员是线程安全的。不保证任何实例成员都是线程安全的。
另请参阅
参考
Schema 成员
Microsoft.Office.Server.Search.Administration 命名空间