SharePoint 2010: Removing Default Search Content Source

SharePoint 2010: Removing Default Search Content Source

There is no option to delete the default search Content Source in sharepoint so here is a way to manually do it via Visual Studio.

  1. Open Visual Studio 2010.
  2. Go to File => New => Project.
  3. Select Console Application from the installed templates.
  4. Enter the Name and click Ok.
  5. Add the following references.
Microsoft.SharePoint.dll
Microsoft.Office.Server.dll
Microsoft.Office.Server.Search.dll
  
Add the following namespaces
using Microsoft.Office.Server.Search.Administration;
using Microsoft.Office.Server;
using Microsoft.SharePoint;
  
Replace the code with the following.
// search service application name
 string ssaName = "Search Service Application";
 SearchContext context = SearchContext.GetContext(ssaName);
Content ssaContent = new Content(context);
 ContentSourceCollection ssaContentSources = ssaContent.ContentSources;
 ContentSource cs = ssaContentSources["Local SharePoint Sites"];
 cs.Delete();


Leave a Comment
  • Please add 3 and 2 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 1. Comment: Removed (en-US) from title, modified title casing

  • Craig Lussier edited Original. Comment: added en-US to tags and title

Page 1 of 1 (2 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Craig Lussier edited Original. Comment: added en-US to tags and title

  • Richard Mueller edited Revision 1. Comment: Removed (en-US) from title, modified title casing

Page 1 of 1 (2 items)