locked
Add webpart to all pages dynamically RRS feed

  • Question

  • I need to add web part to all pages within a site collection, what's the best approach to do so? I am approaching it by creating a feature receiver that loops through all sitepages library and open web part manager to add the webpart, but the thing is that I need to check if the web part is already added to the page in case I create a new webpart.
    Sunday, June 28, 2015 3:10 AM

Answers

  • You should be adding the new functionality in your master page or page layout. That would be the best approach to do it, not to loop through all pages and modify them. That way newly created pages will pick up the change in the master page as well as old pages.

    Mohamed Derhalli

    SharePoint Consultant

    Blog: SharePoint Thoughts    Twitter:    LinkedIn:   

    Sunday, June 28, 2015 5:29 AM