Showing posts with label web part gallery. Show all posts
Showing posts with label web part gallery. Show all posts

Wednesday, July 1, 2009

Getting a web part's title and description (in .webpart) to update in the SharePoint site's Web Part Gallery

Here's one of those fun times with SharePoint, you know, where something simple doesn't work and you have to do backflips to get it to do what you want it to do. Now, to be fair, SharePoint has come a really long way, but there's still some quirky stuff we run into from time to time.

I developed a web part in Visual Studio 2008 and was getting ready to bundle it up for deployment using WSPBuilder. I then realized that I had not changed its default title and description. This information is set in the web part's .webpart file. In my case, its in AddContactFromAD.webpart. Upon deployment, you can see this information in the Web Part Gallery (Site Actions -> Site Settings -> Web Parts (under Galleries). If you click the Edit icon next to your web part, you see the Title and Description fields containing what was set in the .webpart file. When a user goes to add a web part to a page (Site Actions -> Edit Page -> click Add a Web Part), they see this title and description.

So I thought, no biggie, I'll just update the title and description in the .webpart file and redeploy and everything should be updated like usual, right? Wrong! I went back to the Web Part Gallery and the title and description hasn't changed a bit.

So an hour or two later, and after coming across another issue while trying to solve this issue, I finally came up with the solution.
  1. In Visual Studio, make your .webpart file's title and description the way you want them
  2. Delete the web part from the Web Part Gallery - a. Click Site Actions -> Site Settings -> Web Parts (may need to click "Go to top level site settings" for Web Parts to show up; b. Click the Edit icon of the web part; c. Click Delete Item
  3. Deactivate the web part - a. In Site Actions -> Site Settings -> Site Collection Features; b. click Deactivate next to web part
  4. In Central Administration -> Operations -> Solution Management, click web part's solution .wsp file, click Retract Solution and OK, and after its Status has changed to Not Deployed, click the .wsp file again and click Remove Solution
  5. Close out of Visual Studio. This was the other issue I referred to above: at this point, if you attempt to deploy the web part without closing out Visual Studio and reloading it, you will get the error "The language-neutral solution package was not found"
  6. After reloading Visual Studio, redeploy the web part!