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!

5 comments:

  1. Hello DJ, I came across your blog while I was researching a way to populate a Sharepoint list from Active Directory. I'm also in WPB and wondering if there are any SP "support groups".
    Thanks, Cynthia

    ReplyDelete
  2. Hey Cynthia,
    Honestly, I don't know! I am interested in finding one, so we'll have to update one another when we find one. Whenever we have Microsoft training, we go down to Homnick Systems in Boca Raton http://www.homnick.com/. Joe Homnick is a really knowledgeable guy and he is doing a lot of SharePoint training. I was down there for SharePoint training a month ago, in fact. And through him, I was made aware of the Gold Coast User Group http://gcusersgroup.org/, but I have never interacted with them. I would guess they probably deal with SharePoint by the simple fact that Joe is affiliated with them. On the right column of my site towards the bottom, you'll notice Useful Blogs/Forums. I really like those sites a lot. They seem to have a lot of people checking them so there's a good shot you'll get some answers to your questions. Did my post on populating a list from Active Directory handle your scenario?

    ReplyDelete
  3. Another thing to try if you get the "Language-Neutral solution package not found" issue is to go to bin/debug folder for the feature, then run "setup -u", and then "setup" to redeploy.

    Still not getting all the descriptions to update though.

    ReplyDelete
  4. Use "WebPartDescription" instead of "Description" in your File properties xml, and the descriptions will update. However, I'm still searching for a way to pass a "Title" value into the Web Part Gallery...

    ReplyDelete
  5. I got some issue when upgrade install wepparts getting old tiltle, description and catalog. Can anyone suggest what needs to be done to get latest title.

    ReplyDelete