I am currently trying to add a web part to a page. All i think is well however i am using a piece of code that i thought returned all existing webparts but really it only returns the web parts that are currently on a given page.
web.GetWebPartCollection(url,storage);
I was hoping to get the reference to my web part that already resides in the web part gallery from the collection returned by the above code but my web part hasn’t been deployed to the page yet as that’s what i am trying to do!!!!
Does anyone know how i can get access to the web part gallery via a piece of c# code?
This should do it:
siteCollectionUrl is the URL of the site collection for which you wish to load the web part gallery of.
the SPList webPartGallery will contain all of the web parts in the current site collection’s gallery.
EDIT:
It’s probably also worth mentioning the difference in naming conventions in Sharepoint: