Is there an easy way to find out which sites/pages are using a particular web part in SharePoint 2007?
A:
I think the only option would be to write a small tool that iterates over all web sites and pages and checks whether the web part is placed there.
Flo
2010-06-02 08:03:32
A:
If you know your site and page you can find all webparts of page and check if your webpart is there:
string AbsolutePageUrl = "http://YourSite/Page.aspx";
using (SPSite site = new SPSite(AbsolutePageUrl))
{
using (SPWeb web = site.OpenWeb(AbsolutePageUrl))
{
SPLimitedWebPartManager SpWebPartManger = web.GetLimitedWebPartManager(AbsolutePageUrl,
System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
foreach (var webpart in SpWebPartManger.WebParts)
{
if (webpart is MyWebPart)
//your web part is here
}
}
}
but if you want to check this in all sites you have to find all sites and all pages to check for your webpart Existence
Hameds
2010-06-04 06:33:17