26. Resource and References
Microsoft SharePoint Products and Technologies Web sites
Web Parts in Windows SharePoint Services MSDN
Inside Microsoft Windows SharePoint Services 3.0 byTed PattisonandDaniel
Larson
Microsoft Office SharePoint 2007 Technical Enablement Tour by Patrick
Tisseghem (Managing Partner – U2U)
The primary task of the SharePoint developer is to build reusable components for business users. Business users in turn will take these components and build applications, customizing the application for the particular business need and personalizing the application for their own working style. This development mindset is in contrast to typical Windows or Web software that is deployed as a complete unit. With WSS technologies, the application is always evolving as business users employ deployed components to build their own applications and workspaces. Web Parts are used within the site to enable further collaboration or integration within the site context.Web Parts are the fundamental building blocks for SharePoint’s user interface, and with them we can build and integrate many different types of applications. The built-in Web Parts serve as good design examples when writing your own. For example, the Data View Web Part can be configured to point at any data source and display the data in many different ways. In the same way, all of the Web Parts that ship with WSS are generic and built for reuse. Although you may build more specific applications with Web Parts, it is important to be as generic as possible to allow the greatest flexibility for your customer, the business user, who can then configure the Web Part for a specific use.
Customization and personalization of Web Parts enable your Web Parts to be reused for multiple business applications. Customization refers to a change that is shared by all users of the Web Part instance, whereas personalization is specific to the individual user’s Web Part instance. For example, the site owner may choose a specific news feed to display on a site’s home page. This would be a customization, because the change would be shared by all users of the site. Individual users on the site may choose different rendering formats according to their preferences, which would be an example of personalization. Personalization applies to individual users and is persisted on a per-user basis.To add a new custom property, just add a public property and the Personalizable attribute. The WebBrowsable, WebDisplayName, WebDescription, and Category attributes also will be useful in administering the property from the Web Part’s Editor Parts. These attributes are defined in the System.Web.UI.WebControls.WebParts and System.ComponentModel namespaces.If you create a property and apply the WebBrowsable attribute, the Web Part framework will automatically display this property in a generic Editor Part when the user selects Modify Web Part. An Editor Part is a special type of control that is used only to edit Web Part properties that support customization and personalization
Sometimes you may have an existing Web page application that needs to be ported to SharePoint. It is relatively simple to do this by converting the pages to User Controls. Although User Controls aren’t recommended for all Web Part applications, they can be a quick way to get an ASP.NET application deployed into your SharePoint Web sites. User Controls deployed in SharePoint either must inherit from the UserControl class or from a UserControl-derived class that is available to the Web application (through either the bin directory or the GAC) and must exist in the same IIS Web application. Web Part code then can load the control and add it to your Web Part using the method Page.LoadControl. Since your User Control will exist on the file system and not in the content database, it can contain inline code if needed, since it isn’t processed through the Safe Mode Parser. Note that you cannot deploy User Controls through the content database. You only have to load the control and add it to the controls collection, and the Control framework will render it
Enabling .NET 3.5 in SharePoint 2007 Sites (Include AJAX and Silverlight)Start Visual Studio 2008.Create a new dummy ASP.NET Web Application Project, and make sure you target the .NET Framework 2.0 (upper right dropdown of the New Project dialog). The name of this project is not important; you won’t need it anymore when we’re done.Copy the web.configof your SharePoint 2007 site, into the dummy Web Application project in Visual Studio.Open the Project Properties in Visual Studio (right click on the Project node in the Solution Explorer, and choose Properties; or in the Project menu, select WebApplicationX Properties).Select .NET Framework 3.5 in the Target Framework dropdown (select Yes in the confirmation dialog).Copy the web.config from the Web Application Project back to SharePoint.
A Web Part Verb is an action that is rendered in the Web Part menu by the Web Part framework as part of the chrome that is rendered around the control. The action can call a client-side function or a server-side handler. To add Web Part Verbs as menu items, override the Verbs property of the Web Part. The Verbs property returns a read-only WebPartVerbCollection, so you will need to merge a collection of Verbs with the base.Verbs property to create a new WebPartVerbCollection.
Web Part connections are another Web Part technology that enables reuse among diverse applications. Connections are frequently used for master/detail records and are used in Web Parts for late-bound connections. As long as a Web Part provides data that your Web Part can consume, it can be connected using the Web Part frameworkConnections are enabled through the ConnectionProvider attribute. The simplest way to add a connection to your Web Part is by implementing a custom interface such as the ICustomerProvider interface and specifying the data object with the ConnectionProvider attribute. To connect to the provider Web Part, the consumer Web Part simply marks a connection method with the ConnectionConsumer attribute.