Partager via


Content, classe (Microsoft.Office.Server.Search.Administration)

Represents the top-level object for administration of the content sources for a Shared Services Provider's (SSP) search service.

Espace de noms : Microsoft.Office.Server.Search.Administration
Assembly : Microsoft.Office.Server.Search (dans microsoft.office.server.search.dll)

Syntaxe

'Déclaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
Public NotInheritable Class Content
'Utilisation
Dim instance As Content
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
public sealed class Content

Remarques

Use the constructor of the Content class to create a Content object that allows you to access and administer the content sources for an SSP.

For more information about content sources and the new Recherche de contenu d'entreprise Administration object model, see Vue d'ensemble des sources de contenu, Gestion du contenu, and Getting Started with the Search Administration Object Model.

Exemple

The following code example writes out the full list of content sources for an SSP to a console window. For a complete, step-by-step walkthrough of this sample code, see Procédure : récupérer les sources de contenus pour un fournisseur de services partagés.

Prerequisites

Ensure an SSP 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;
using System.Text;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.SharePoint;

namespace ContentSourcesSample
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            Replace <SiteName> with the name of
            a site using the Shared Services 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);
             }
        }
    }
}

Hiérarchie d'héritage

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

Sécurité des threads

Les membres statiques publics de ce type (Shared en Visual Basic) sont sécurisés au niveau des threads. Il n'est pas garanti que les membres d'instance soient sécurisés au niveau des threads.

Voir aussi

Référence

Membres Content
Microsoft.Office.Server.Search.Administration, espace de noms

Autres ressources

Mise en route avec le modèle objet Administration de recherche de contenu d'entreprise
Vue d'ensemble des sources de contenu
Gestion du contenu
Procédure : récupérer les sources de contenus pour un fournisseur de services partagés
Procédure : ajouter une source de contenu
Procédure : supprimer une source de contenu
Procédure : gérer l'analyse d'une source de contenu par programme
Procédure : configurer par programme une planification d'analyse pour une source de contenu