Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

Opening Web Parts Gallery Programmatically

leave a comment »

Navigating to the Web Part Gallery in the browser interface takes you to http://site collection URL/_layouts/_catalogs/wp/Forms/AllItems.aspx. Attempting to open the list through “_catalogs/wp” will fail:


SPList spWPG = spWeb.Lists["_catalogs/wp"];  // does not work

 Instead, you need to use the following code:


SPList spWPG = spWeb.Lists["Web Part Gallery"];

Reference: http://meiyinglim.blogspot.com/2007/10/programatically-organizing-web-parts-in.html

Advertisements

Written by Nick Grattan

June 23, 2011 at 12:21 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: