Compartir a través de


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

Provides the base class for all Enterprise Search content sources.

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

Sintaxis

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

Comentarios

For more information about content sources and the new Enterprise Search Administration object model, see Introducción a los orígenes de contenido, and Getting Started with the Search Administration Object Model.

Use the ContentSources property of the Content class to get the collection of content sources for a Shared Service Provider (SSP).

To add a new content source to the collection, use the Create method of the ContentSourceCollection class.

To delete a content source, use the Delete method of the ContentSource class.

Use an indexer to return a single content source from the ContentSourceCollection object. For example, assuming the collection is assigned to a variable named sspContentSources, use sspContentSources[index] in Microsoft Visual C# or sspContentSources(index) in Microsoft Visual Basic, where index is a string containing the name of the content source or an integer containing the content source ID.

Ejemplo

The following code example writes out the full list of content sources for a Shared Service Provider 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.Collections.Generic;
using System.Text;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.SharePoint;

namespace ContentSourceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            Replace <SiteName> with the name of a site
            using the Shared Service Provider.
            */
            string strURL = "http://<SiteName>";
            SearchContext context;
            using(SPSite site = new SPSite(strURL))
            {
            context = SearchContext.GetContext(site);
            }
            Content sspContent = new Content(context);
            ContentSourceCollection sspContentSources = sspContent.ContentSources;
            foreach (ContentSource cs in sspContentSources)
            {
                Console.WriteLine("NAME: " + cs.Name + "  ID: " + cs.Id);
            }
        }
    }
}

Jerarquía de herencia

System.Object
  Microsoft.Office.Server.Search.Administration.ContentSource
     Microsoft.Office.Server.Search.Administration.BusinessDataContentSource
     Microsoft.Office.Server.Search.Administration.CustomContentSource
     Microsoft.Office.Server.Search.Administration.HierarchicalContentSource
     Microsoft.Office.Server.Search.Administration.SharePointContentSource
     Microsoft.Office.Server.Search.Administration.WebContentSource

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

ContentSource (Miembros)
Microsoft.Office.Server.Search.Administration (Espacio de nombres)
Content (Clase)

Otros recursos

Introducción al modelo de objetos de administración del motor de búsqueda Enterprise Search
Introducción a los orígenes de contenido
Administración de contenido
Procedimiento para recuperar los orígenes de contenido para un proveedor de servicios compartidos
Procedimiento para agregar un origen de contenido
Procedimiento para eliminar un origen de contenido
Procedimiento para administrar mediante programación el rastreo de un origen de contenido
Procedimiento para configurar mediante programación una programación de rastreo para un origen de contenido