Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How to delete the site url from crawl list through object model?

  Asked By: Abhilasha    Date: Aug 04    Category: Sharepoint    Views: 878

i can add a site to crawl list through the following code in c# using
Object Model


AreaManager.SuggestDeepCrawl( portalContext,
"THE SITE SEVENTEEN",
"Description for site 17",
siteUrl,
"" /* LargeIconUrl */,
"" /* SmallIconUrl */,
"$$$default$$$" /* Index Catalog */,
"$$$default$$$" /* Index Scope */);


Can any one show me the way i can delete a perticular url from crawl
list?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Deven Gajjar     Answered On: Aug 04

I'm don't know if you can do this using SharePoint OM. Please let me know if
find something.

 
Answer #2    Answered By: Latisha Schneider     Answered On: Aug 04

I got the solution... see below code  to delete  the site  from crawl
list.

TopologyManager tm = new TopologyManager();
PortalSite portal = tm.PortalSites[siteUri];
PortalContext portalContext = PortalApplication.GetContext(portal);

Area areaDeepCrawl = AreaManager.GetArea
(portalContext,AreaManager.GetSystemAreaGuid
(portalContext,SystemArea.DeepCrawl));

foreach(AreaListing listing in areaDeepCrawl.Listings)
{
if(listing.URL.ToString().ToUpper().CompareTo
(js.SourceUrl.ToUpper)) == 0)
{

areaDeepCrawl.Listings.RemoveListing(listing.ID);
break;
}
}


For other details please download 'SPUtilSuite' developed by Keith
Richie. This tool comes with source code which is one of the best
reference for the sharepoint Object Model developer.

Url for 'SPUtilSuite' download :
www.microsoft.com/.../detail.asp?
a1=724

 




Tagged: