Overview Of Web Parts Framework

15
Overview of Web Parts Framework A Microsoft ® Office FrontPage ® 2003 White Paper This white paper gives an overview of the Web Part Framework in Windows SharePoint Services, and provides a walkthrough of building a sample Web Parts Page using Microsoft FrontPage 2003. Note: The instructions, screenshots, and behavior discussed in this white paper are based on Microsoft Internet Explorer version 5.5 or above. The user experience with prior versions of Microsoft Internet Explorer and with other browsers is going to be different – in general, the same level of features may not be available. Published: September 2003 For the latest information, please see http://www.microsoft.com/frontpage/default.htm (Style = Body Text)

Transcript of Overview Of Web Parts Framework

Page 1: Overview Of Web Parts Framework

Overview of Web Parts FrameworkA Microsoft® Office FrontPage® 2003 White Paper

This white paper gives an overview of the Web Part Framework in Windows SharePoint Services, and provides a walkthrough of building a sample Web Parts Page using Microsoft FrontPage 2003.

Note: The instructions, screenshots, and behavior discussed in this white paper are based on Microsoft Internet Explorer version 5.5 or above. The user experience with prior versions of Microsoft Internet Explorer and with other browsers is going to be different – in general, the same level of features may not be available.

Published: September 2003

For the latest information, please see http://www.microsoft.com/frontpage/default.htm (Style = Body Text)

Page 2: Overview Of Web Parts Framework

Contents

Introduction........................................................................................................................... 1

Web Part Framework............................................................................................................2What Are Web Parts?......................................................................................................2Web Parts and Windows SharePoint Services..................................................................3Composition of a Web Part...............................................................................................3

Walkthrough: Using Web Parts..............................................................................................4Adding Web Parts to a Page............................................................................................6Deleting Web Parts from a Page......................................................................................8

Conclusion............................................................................................................................ 9

References......................................................................................................................... 10Other Microsoft Resources.............................................................................................10

Page 3: Overview Of Web Parts Framework

IntroductionThe Web Part Framework in Windows SharePoint Services provides a powerful and easy to use platform for developing data driven Web sites which:

Can be customized at runtime by end users and knowledge workers

Offers shared and personal views of data to enable the creation of personalized pages

Enables powerful collaborative scenarios by simply and easily creating sites for working with shared documents, creating meetings, etc.

Has built-in extensibility and code re-use – developers can write re-usable Web Parts which can be quickly plugged into a site and which leverage all the powerful features of the .NET framework

Offers a scalable architecture that can host the needs of a small workgroup to a large enterprise

Because Microsoft FrontPage 2003 integrates closely with Windows SharePoint Services and is the easiest and the most powerful Web site design tool available to customize SharePoint Services-based sites, it enables creation of a new category of collaborative, scalable, data driven Web sites.

The Web Part Framework in Windows SharePoint Services is used by three categories of users:

End users personalize a Web Part Page to simplify and focus on the information that is most relevant to them. They do this by customizing Web part properties

Web Page Authors use Web Parts to build custom solutions based on Windows SharePoint Services.

.NET developers extend Windows SharePoint Services by encapsulating Web services and enterprise data as Web Parts.

The goal of this document is to focus on the Web page authors, discuss the basics of the Web Parts Framework, and provide a simple walkthrough which builds a Web Part Page using FrontPage 2003 in a step-by-step fashion.

This document describes how Web page authors can use Microsoft FrontPage 2003 to leverage Windows SharePoint Services and use the Web Part Framework to easily build data driven Web sites using a library of readily available Web parts.

Page 4: Overview Of Web Parts Framework

Overview of Web Parts Framework 1

Web Part FrameworkThe Web Part Framework is the basis for extensibility in Windows SharePoint Services. It allows developers to write custom components that plug into the SharePoint infrastructure by encapsulating Web services and enterprise data as Web Parts.

Windows SharePoint Services as a whole is based heavily on .NET technologies:

ASP.NET instead of ISAPI for base page execution

Microsoft common language runtime (CLR) based server object model for programmatic access to SharePoint data

XML Web services-based access of SharePoint data from remote machines

In keeping with this investment in .NET technologies, the Web Parts Framework is also based entirely on ASP.NET:

Web Part pages are ASP.NET pages.

Web Parts are ASP.NET custom controls.

The fundamental notion in the Web Part Framework is that of a Web Part Page. A Web Part Page is essentially a scalable version of the Digital Dashboard. It is a container of Web Parts. A Web Part Page uses Windows SharePoint Services to store per-user views of the page, which enables powerful customizations on a user-by-user basis.

Note: Digital dashboards are customized portals that consolidate information into one location. Digital dashboards benefit businesses by reducing the time and effort needed to locate and manage information from multiple sources.

What Are Web Parts?

Web Parts are customizable plug and play components that empower information workers to create personalized user interfaces by simply dragging and dropping them onto a Web page. Web parts allow customization at both design time and at run time. In fact, Web Parts blur the distinction between design time and run time:

Web page authors use FrontPage 2003 to work with Web Parts by dragging and dropping them to a Web Part Page, and then customizing them using developer enabled properties. In this sense, Web Parts are similar to design time controls. Web Part developers also have control over the design time preview of their Web Parts, ensuring a rich experience for the Web page authors.

Web Parts also enable Web page authors to use the browser as their authoring platform. Windows SharePoint Services provides a browser-based interface to design a SharePoint Services-based site.

The end user can customize a Web Part Page at run time by modifying the properties of each individual Web part. The page author can designate which Web parts can be customized or not by grouping them into “zones” and setting the appropriate properties on the zone using FrontPage 2003. The ability to manipulate (add/edit/delete) Web part zones is a unique capability of FrontPage 2003.

From the point of view of a developer, a Web part is simply an ASP.NET server control. To create a new Web Part, you create an ASP.NET custom control. However, unlike standard ASP.NET controls, which developers add to Web form pages at design time, Web Parts are intended to be added to Web Part Pages either by authors at design time, or by users at run time.

Page 5: Overview Of Web Parts Framework

Overview of Web Parts Framework 2

Note: Developers can also use Web Parts in “regular” ASP.NET pages, but in doing so, the developer loses the advantages of integration with Windows SharePoint Services.

Web Parts and Windows SharePoint Services

Web Parts rely heavily on Windows SharePoint Services to support:

Creation of new sites and new pages

Management of the user roster for a site

Storage of Web Part customizations, including shared and personal property settings

Administration of site backups and storage limits

A scalable architecture that can handle thousands of sites and millions of users

Assignment of users to customizable site groups

In turn, SharePoint Products and Technologies rely on Web Parts to provide configurable and extensible user interfaces.

Composition of a Web Part

A Web Part is composed of the following entities:

The Web Part description file (.dwp) is a portable container of default and personalized property values for the Web Part.

The Web Part assembly file (.dll) contains the logic and code for the Web Part, and is installed on the server running Windows SharePoint Services.

Resource files that support the Web Part; these are also stored on the server.

Tables in the Windows SharePoint Services database are used to store current values of the Web Part properties.

Windows SharePoint Services has been designed from the ground-up to be a powerful collaborative platform. It is possible and indeed commonplace for your Web site to contain multiple instances of the same Web Part. Each instance could conceivably have a different set of properties.

Regardless of the number of instances of the Web Part, there is only one Web Part assembly file. There is no requirement that a Web part have a .dwp file. Dwp files are only used to export and import a Web part from and to a site, and for representing a Web part in the site’s Web part gallery. Typically Web part instances are stored in the database (for parts in zones) or embedded right in the page (for parts not in zones).

Page 6: Overview Of Web Parts Framework

Overview of Web Parts Framework 3

Walkthrough: Using Web PartsIn this section, we will create a Windows SharePoint Services-based Web site using FrontPage 2003. We will add a Web Part Page to the site and put some Web Parts into the page. The intent is to provide an overall idea of how Web page authors can use FrontPage 2003 to work with Web Parts.

Note: For this example, we assume there is a top level SharePoint site called “Team Site”, for which the URL is http://MyServer. This is simply the default Web site created by Windows SharePoint Services. Any Web site created in this and later sections will be subsites of this site.

To create a SharePoint Services based Web site using FrontPage 2003, follow these steps:

1. Open FrontPage 2003.

2. From the View menu, open the Task Pane and choose “New” from the list of tasks in the Pane.

3. Under “New Web Site”, click on “More Web Site Templates”. This brings up the “Web Site Templates” dialog box.

4. Click on the SharePoint Services tab. Choose Team Site and enter a URL for the site.

Note: We have named the site http://MyServer/my-workgroup

5. Click OK to create the site.

The new site comes with the following SharePoint lists:

Announcements

Contacts

Events

General Discussion

Links

Tasks

A SQL Server database stores the data for each list. Each list is also associated with several forms (aspx pages) which enable the user to view the list, create a new list item, etc.

The site also comes with a document library. A document library allows users to collaborate with shared documents.

Finally, the site has a default Web forms page, called default.aspx. Double click on this page to open it in design mode. It should look similar to the following:

Page 7: Overview Of Web Parts Framework

Overview of Web Parts Framework 4

Since Windows SharePoint Services relies on ASP.NET technology for rendering, it should come as no surprise that this is an aspx page. However, this is not your usual aspx page. It is a Web Part Page – i.e., it is a container for Web Parts. The user can customize these Web parts at run time.

You can arrange Web Parts on the page in various Web part zones. Each Web part zone contains one or more Web parts and you can apply common properties to the zone to control the behavior of all the Web parts in the zone. Web part zones are discussed in more detail in the companion white paper, “FrontPage 2003: Working with Web Part Pages”.

This page has two Web part zones; the first zone, labeled as “Left” in the previous screen shot, has two Web parts: Announcements and Events. The second zone, labeled as “Right”, also has two Web parts: an Image Web part containing the logo for Windows SharePoint Services and a Links Web Part.

You can edit the properties for each Web part by simply right-clicking on the Web part and choosing “Web Part Properties”. This brings up a property editor window. For example, when you do this on the “Announcements” Web part, the property editor window looks like this:

Page 8: Overview Of Web Parts Framework

Overview of Web Parts Framework 5

Web part property editor dialog

Note: The properties that you see in this dialog may differ depending on the properties that the Web Part developer chooses to expose for the Web Part

You can simply and easily modify the properties of the Web part by using this window. While the property editor allows you to control the layout and appearance of the Web part, you can do more advanced customization of Web parts from the Data menu: Style, Sort and Group, Filter. The Data menu commands pertain to List View and XSLT Data View Web parts only. Web Part customization is discussed in more detail in the companion white paper, “FrontPage 2003: Customizing Web Parts”.

Adding Web Parts to a Page

To add Web Parts to this page, follow these steps:

1. From the Data menu, choose Insert Web Part… to bring up the Web Parts task pane on the right. This task pane lets you choose the Web Parts that you want to insert into the page.

Note: The Insert Web Part menu item is disabled in a non-SharePoint Services environment.

The metaphor is similar to choosing a control from a toolbox. In fact, this metaphor is quite accurate at a deeper level too because Web parts are ASP.NET custom controls. Also, the list of available Web parts is organized into “Libraries”. There are three levels of categorization provided by the libraries: Site, Virtual Server, and Online libraries. Web Part libraries are discussed in more detail in the companion white paper, “FrontPage 2003: Working with Web Part Libraries”.

2. Choose the Team Web Site Library. The name of this library may be different – its name is the same as the name of the top level site.

Page 9: Overview Of Web Parts Framework

Overview of Web Parts Framework 6

3. Choose the Contacts Web Part from the Web Part List. If you have a default installation of Windows SharePoint Services, then this should be second Web Part, right under the Announcements Web Part.

4. Drag and drop the part into the left Web Part Zone, below the Events Web Part. As you can see, the metaphor for adding Web parts is similar to that for adding any ASP.NET control.

Once a Web Part is added to a page, FrontPage 2003 allows customization of many aspects of the Web part, including its appearance, layout, toolbars, etc. You can access these customizations either from the “Data” menu or by clicking the “List View Options” icon that appears at the top left hand corner of the Web part when it is clicked. The screenshot below shows the icon and the submenu which appears by clicking on it:

5. Click on Style and in the View Styles dialog, click on the General tab.

6. Check the HTML radio button and choose the Two Boxed style (for a default installation, this should be the 4th style in the list), and click OK. On the task pane the Data View Details should be displayed.

7. Choose Manage View Settings, click on Fields and choose only the Last Name, First Name, Email Address, Company, and Business Phone fields.

Now, your page should look similar to the following screenshot (when you have some sample contact data in this list):

Page 10: Overview Of Web Parts Framework

Overview of Web Parts Framework 7

Default after adding & formatting the Contacts Web part

Deleting Web Parts from a Page

Deleting a Web part from a page is simple: Simply click on the Web part to select it and hit the “Delete” key. Again, the metaphor is very similar to working with ASP.NET controls.

Page 11: Overview Of Web Parts Framework

Overview of Web Parts Framework 8

ConclusionThe Web Parts Framework in Windows SharePoint Services provides a powerful and easy to use platform for developing data driven Web sites. Because Microsoft FrontPage 2003 integrates closely with Windows SharePoint Services and is the easiest and the most powerful Web site design tool available to customize SharePoint Services-based sites, it enables creation of a new category of collaborative, scalable, data driven Web sites.

Page 12: Overview Of Web Parts Framework

Overview of Web Parts Framework 9

ReferencesFrontPage 2003: Working with Web Part Pages

FrontPage 2003: Customizing Web Parts

FrontPage 2003: Connecting Web Parts

FrontPage 2003: Working with Web Part Libraries

FrontPage 2003: Working with the Data View Web Part

FrontPage 2003: An Architectural Introduction to Web Parts and ASP.NET

Other Microsoft Resources

Microsoft FrontPage 2003 Customization Kit Web: http://www.sharepointcustomization.com

Microsoft FrontPage Web site:http://www.microsoft.com/frontpage/default.htm

Microsoft FrontPage Add-in Center: http://www.microsoft.com/frontpage/downloads/addin/default.asp

Microsoft SharePoint Products and Technologies:http://www.microsoft.com/sharepoint/default.asp

SharePoint Products and Technologies Web Component Directory:http://www.microsoft.com/sharepoint/downloads/components/default.asp

Page 13: Overview Of Web Parts Framework

Overview of Web Parts Framework 10

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.

This white paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.

Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in, or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

© 2001 Microsoft Corporation. All rights reserved.

The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred.

Microsoft, FrontPage, and SharePoint are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.