Intro to SharePoint: Web Parts
August 8, 2008
I started listening to some webcasts that were put together for .NET developers who need to learn SharePoint (me). These webcasts focus on basic SharePoint concepts in hour-long segments, and can be found here. The one I listened to today was on Web Parts, and here is what I got from the presentation.
Speaker:
Robert Bogue
Microsoft MVP for MOSS
Thor Projects LLC
WEB PARTS
Web parts are modular and reusable building blocks used to build portal-style applications. They can be customized and personalized, meaning two people can use the same web part at the same time, and based on their personal properties, the web part will display something completely different for each person. I can also have two instances of the same web part running on the same page at the same time, as long as the properties are different (such as two weather report web parts, one for Chicago and one for LA). Web parts are a great way to put custom code into a SharePoint site
Web part infrastructure is required.
Web parts are available out of the box with Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007.
A web part page in WSS includes:
SPWebPartManager
One or more SPWebPartZones
Editor Zones
Catalog Zones
DEVELOPMENT:
A web part project must inherit from System.Web.UI.WebControls.WebParts.WebPart
2 ways to install the assembly
Put in BIN folder
Put in GAC
<SharePoint>
<SafeControls> …
needs to be in the configuration section of the config file on every front-end Web Server
Web parts support persistent properties
On a user basis (customizable for each user)
Tracked once for all users
Users can modify them through the browser
Or, for more complex and controlled editing, you can use the GetEditorParts method
Connectable web parts route the output of one web part into the input of another web part. (Good for Master-detail, searching, filtering.)
There is no built-in support for treating .ascx files (user controls) as web parts, but you can use .ascx files in pages. You use the LoadControl method of the Page object to load an .ascx file at runtime.
ASCXs can be dropped in IIS web app folder or in 12\Template\ControlTemplates folder.
Wrappers for ASCXs are available, or you can build your own
OTHER:
Become familiar with the way web parts are deployed in a SP environment
Deploy in BIN folder
Registration of Safe Control
User features to make web parts available
User solutions to deploy web parts inside the farm