Search code examples
c#.netsharepointwindows-sharepoint-services

How do I enumerate web part types in WSS site


How would I go about enumerating the web part types available to be deployed to a web part page in a particular SPWeb by a user on a WSS 3.0 site? Sort of the equivalent of the list that you'd get via the "Add Web Part" link, but in a collection so that they could be instantiated and then added to a page.


Solution

  • I found this excellent post which enumerates the contents of the WebPart Gallery and can then instantiate any type found:

    Add Web Part To SharePoint Page