CrawledProperty Class
Represents a crawled property in the Enterprise Search metadata property schema.
Inheritance Hierarchy
System.Object
Microsoft.Office.Server.Search.Administration.CrawledProperty
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 CrawledProperty
'Usage
Dim instance As CrawledProperty
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class CrawledProperty
Remarks
Crawled properties are the set of properties discovered by the Enterprise Search index service component when crawling content. For more information about crawled properties, see Managing Metadata.
Crawled properties are grouped by category, based on the protocol handler that is used. Use the GetAllCrawledProperties method of the Category class to get the collection of CrawledProperty objects representing the crawled properties for a specific category.
Crawled properties are mapped to managed properties to make them available for the Enterprise Search user experience. Use the GetMappedCrawledProperties() method of the ManagedProperty class to get the collection of CrawledProperty objects that represent the crawled properties mapped to specific managed property.
Examples
The following code example writes out a list of crawled properties, which are mapped to a specific managed property, to the console window. For a complete, step-by-step walkthrough of this sample code, see How to: Retrieve the Crawled Properties Mapped to a Managed Property.
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;
using System.Text;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.SharePoint;
namespace CrawledPropertiesSample
{
class Program
{
static void Main(string[] args)
{
try
{
//Replace <SiteName> with the name of a site that uses the Shared Service Provider.
string strURL = "http://<SiteName>";
Schema sspSchema = new Schema(SearchContext.GetContext(new SPSite(strURL)));
ManagedPropertyCollection props = sspSchema.AllManagedProperties;
//Replace <ManagedPropertyName> with the name of a managed property.
ManagedProperty mProp = props["<ManagedPropertyName>"];
foreach (CrawledProperty cProp in mProp.GetMappedCrawledProperties(mProp.GetMappings().Count))
{
Console.WriteLine(cProp.Name);
Console.WriteLine(cProp.Propset);
}
return;
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
}
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.