In a feature I need to check if a part is already on the page.

How can this be performed (programatically) (i.e. through a feature)


1 Answer 1

SPLimitedWebPartManager manager = web.GetLimitedWebPartManager("default.aspx", PersonalizationScope.Shared);
if (manager != null)
    foreach (Microsoft.SharePoint.WebPartPages.WebPart webpart in manager.WebParts)
        if (webpart.Title == "some title")
            // Web Part found!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.