Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Category Interface

SharePoint 2010

Represents a Category object, controls settings for crawled properties in a category, and enables querying of crawled properties within the category.

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 Category

Use the AllCategories property of the Schema class to get the collection of property categories in the index schema. Use an indexer to return a single category from the CategoryCollection object.

The following code example writes out the full list of categories to the console window.


            using System;
            using Microsoft.SharePoint.Search.Extended.Administration;
            using Microsoft.SharePoint.Search.Extended.Administration.Schema;
            
            namespace CategoriesSample
            {
                class Program
                {
                    static void Main(string[] args)
                    {
                        try
                        {
                            SchemaContext schemaContext = new SchemaContext();
                            Schema schema = schemaContext.Schema;
            
                            CategoryCollection categories = schema.AllCategories;
                            foreach (Category category in categories)
                            {
                                Console.WriteLine(category.Name);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
            }
             
Show:
© 2015 Microsoft