Compartir a través de


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

Represents a category in the Enterprise Search metadata property schema.

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 Category
'Uso
Dim instance As Category
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
public sealed class Category

Comentarios

In the Enterprise Search schema, crawled properties are grouped into different categories, representing the protocol handler used. For more information about crawled properties, see Administración de metadatos.

Use the AllCategories property of the Schema class to get the collection of property categories in the Shared Service Provider's search schema.

Use an indexer to return a single managed property from the CategoryCollection object.

For example, assuming the collection is assigned to a variable named categories, use categories[index] in Microsoft Visual C# or categories(index) in Microsoft Visual Basic, where index is a string containing the name of the category or a GUID identifying the property set for the category.

Ejemplo

The following code example writes out the full list of categories to the console window.

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 CategoriesSample
{
    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)));
                CategoryCollection categories = sspSchema.AllCategories;
                foreach (Category category in categories)
                {
                    Console.WriteLine(category.Name);
                }
            }
            catch(Exception ex)
            {
                 Console.WriteLine(ex.ToString());
            }
        }
    }
}

Jerarquía de herencia

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

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

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