Compartir a través de


: Schema (Clase) (Microsoft.Office.Server.Search.Administration)

Provides access to the property metadata management system for Enterprise Search.

Espacio de nombres:
Ensamblado: Microsoft.Office.Server.Search (in microsoft.office.server.search.dll)

Sintaxis

'Declaración
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
Public NotInheritable Class Schema
'Uso
Dim instance As Schema
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
public sealed class Schema

Comentarios

The Schema class is the entry point for managing the Enterprise Search metadata schema for a Shared Service Provider's search service. To use the Schema object, you must do the following:

  1. Add references to your application for the following dlls:

    • Microsoft.SharePoint.dll

    • Microsoft.Office.Server.dll

    • Microsoft.Office.Server.Search.dll

  2. Specify the Shared Service Provider for the search service using the SearchContext object. For more information about ways to retrieve the search context, see Procedimiento: Devolver el contexto de búsqueda para el proveedor del servicio de búsqueda.

The following topics contain code samples demonstrating how to use the Schema object model to perform various metadata management tasks programmatically:

Procedimiento para recuperar las propiedades administradas para un proveedor de servicios compartidos

Procedimiento para crear una propiedad administrada

Procedimiento para eliminar una propiedad administrada

Procedimiento para recuperar propiedades rastreadas para una categoría del esquema de búsqueda

Procedimiento para recuperar las propiedades rastreadas asignadas a una propiedad administrada

Procedimiento para asignar una propiedad rastreada a una propiedad administrada

Ejemplo

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 Procedimiento para recuperar las propiedades administradas para un proveedor de servicios compartidos.

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());
            }
        }
    }
}

Jerarquía de herencia

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

Seguridad de subprocesos

Todos los miembros estáticos públicos (compartidos en Visual Basic) de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancia sean seguros para los subprocesos.

Vea también

Referencia

Schema (Miembros)
Microsoft.Office.Server.Search.Administration (Espacio de nombres)