Content Class
Represents the top-level object for administration of the content sources for a Shared Services Provider's (SSP) search service.
Inheritance Hierarchy
System.Object
Microsoft.Office.Server.Search.Administration.Content
Namespace: Microsoft.Office.Server.Search.Administration
Assembly: Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)
Syntax
'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class Content
'Usage
Dim instance As Content
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class Content
Remarks
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 Enterprise Search Administration object model, see Content Sources Overview, Managing Content, and Getting Started with the Search Administration Object Model.
Examples
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 How to: Retrieve the Content Sources for a Shared Services Provider.
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);
}
}
}
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.Office.Server.Search.Administration Namespace
Other Resources
Getting Started with the Enterprise Search Administration Object Model
How to: Retrieve the Content Sources for a Shared Services Provider
How to: Delete a Content Source
How to: Programmatically Manage the Crawl of a Content Source
How to: Programmatically Configure a Crawl Schedule for a Content Source