In publishing site you have the additional sites like Document center, News,Reports,Search and sites. While retrieving data from subsites you should stop looping of these subsites like this.
spweb currentweb=spcontext.current.web;
foreach(spweb objSite in currentweb.GetSubwebsForCurrentUser())
{
if (objSite.Title != "Document Center" && objSite.Title != "News" && objSite.Title != "Reports" && objSite.Title != "Search" && objSite.Title != "Sites")
{
//Write your code here.
}
}
spweb currentweb=spcontext.current.web;
foreach(spweb objSite in currentweb.GetSubwebsForCurrentUser())
{
if (objSite.Title != "Document Center" && objSite.Title != "News" && objSite.Title != "Reports" && objSite.Title != "Search" && objSite.Title != "Sites")
{
//Write your code here.
}
}
No comments:
Post a Comment