WebPart


Good to know about WebParts:

  1. The URL to be used for viewing the list of all WebParts available for a Site Collection is constructed as below:

    http://[Portal Server Address/Name]/_catalogs/wp
  2. If you are struggling with a problem which doesn't let a page to be loaded due to a bad WebPart sitting on the page and you need to get rid of the problematic WebPart to be able to load the page, or for any other reason you wish to view a list of WebParts sitting on a page you only need to type the address of the page on address bar of the browser and simply add extension of ?contents=1 to the end of the page address. Assuming page name is mypage.aspx the address will be as below:

    http://[Portal Server Address/Name]/Pages/mypage.aspx.aspx?contents=1
  3. To uninstall a WebPat, one of the options is right clicking on the project name within the Visual Studio 2010 and select the Retract menu option to uninstall the WebPart from the server regardless of the fact that it is either a Farm or Sandbox solution.

    Note: The only thing to remember here is by retracting the WebPart or solution the WebPart name will still remain in the list of available WebParts on edit mode of the pages although that WepPart is not available in reality due to uninstallation. The resolution for that is to browse to list of all available WebParts of the site collection which is explained in no1 of this post (above) and locate the WebPart within the list, select the WebPart and hit the Delete button from the edit ribbon.

SP Visual Studio project namespace & elements' name

There are some notes that need to be put into attention while naming the project items within Visual Studio on creating a SharePoint project. Some of them which I have experienced are listed here.

Visual WebPart Project

    When you create a Visual WebPart Project you will see following hierarchy as part of
    your project items tree.
     

     There are two things that you need to make sure while renaming these files and their contents.
  • Elements.xml[WebPart_Name].webpart (e.g. VisualWebPart1.webpart) should match as below (to see the image in full size click on the image):
  • [WebPart_Name].cs & [WebPart_Name].webpart & SharePointProjectItem.spdata should match as below (to see the image in full size click on the image):