CrawledProperty Interface

SharePoint 2010

Represents a crawled property in the index schema.

Namespace:  Microsoft.SharePoint.Search.Extended.Administration.Schema
Assembly:  Microsoft.SharePoint.Search.Extended.Administration (in Microsoft.SharePoint.Search.Extended.Administration.dll)

[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public interface CrawledProperty

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 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 a specific managed property.

The following code example writes out a list of crawled properties, which are mapped to a specific managed property, to the console window.


            using System;
            using Microsoft.SharePoint.Search.Extended.Administration;
            using Microsoft.SharePoint.Search.Extended.Administration.Schema;
            
            namespace CrawledPropertiesSample
            {
                class Program
                {
                    static void Main(string[] args)
                    {
                        try
                        {
                            SchemaContext schemaContext = new SchemaContext();
                            Schema schema = schemaContext.Schema;
            
                            ManagedPropertyCollection props = schema.AllManagedProperties;
                            //Replace ManagedPropertyName with the name of a managed property.
                            ManagedProperty mProp = props["ManagedPropertyName"];
                            foreach (CrawledProperty cProp in mProp.GetCrawledPropertyMappings())
                            {
                                Console.WriteLine(cProp.Name);
                                Console.WriteLine(cProp.Propset);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
            }
             
Show: