Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SearchContext.GetContext Method (SPSite)

NOTE: This API is now obsolete.

Gets the search context instance for the specified SPSite object.

Namespace:  Microsoft.Office.Server.Search.Administration
Assembly:  Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)
[ObsoleteAttribute("This class is obsolete now. Please use SearchServiceApplication and SearchServiceApplicationProxy instead.")]
public static SearchContext GetContext(
	SPSite site
)

Parameters

site
Type: Microsoft.SharePoint.SPSite

If you specify an SPSite object in the GetContext method to retrieve the search context, we recommend that your code instantiates the SPSite object within a using statement to ensure the object is released once it's no longer needed. See code in the Example section.

For more information about the SearchContext class and the SharePoint Enterprise Search Administration object model, see Getting Started with the Search Administration Object Model and How to: Return the Search Context for the Search Service Provider.

[C#]

SearchContext context;
using (SPSite site = new SPSite("http://yourSiteName"))
{
     context = SearchContext.GetContext(site);

}

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.