Export (0) Print
Expand All
Expand Minimize

Introduction to SharePoint Products and Technologies for the Professional .NET Developer

SharePoint 2007

Summary: Explore the extensible solution platform of SharePoint Products and Technologies and opportunities for its use in .NET development. (32 printed pages)

Erika Ehrli Cabral, Microsoft Corporation

Paul Andrew, Microsoft Corporation

June 2008

Applies to: ASP.NET 2.0; 2007 Microsoft Office system; Microsoft Office SharePoint Server 2007; Microsoft Office SharePoint Designer 2007; Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.2; Visual Studio Tools for the Office system (3.0); Windows SharePoint Services 3.0

Contents

Overview

SharePoint Products and Technologies provide an extensible solution platform for the professional Microsoft .NET developer, and offer a wide array of built-in features and application hosting using well-known .NET development tools and technologies. SharePoint Products and Technologies offer a manageable and scalable server platform that employs the benefits of the 2007 Microsoft Office system client for hosting applications on an internal or Internet Web site.

The.NET developer creates Web-based solutions by using the Web development platform of ASP.NET. ASP.NET allows you to build Web-based solutions by using managed code. The ASP.NET page framework also provides new Web platform capabilities, features, and enhancements such as master pages, Web part controls, and data source controls.

Marrying the advantages and power of both platforms, with the release of the 2007 Microsoft Office system, Microsoft provides products and technologies such as Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007 that are built on top of ASP.NET 2.0. Now you, the professional .NET developer, can use your knowledge of .NET technologies to develop on the SharePoint platform to create a new set of Web solutions.

The goal of this article is to introduce you to some of the most powerful SharePoint development features. This article walks you through key concepts, developer terms, developer components used to build enterprise solutions, and pointers to resources to help you get started learning about SharePoint development. It also explores tools you can use to create solutions by using SharePoint Products and Technologies.

Benefits Offered to .NET Developers

SharePoint Products and Technologies introduce a number of benefits that help not only developers and the solutions they build, but also individual users and organizations of all sizes.

SharePoint Products and Technologies offer additional overall benefits to .NET developers. Highlights of these benefits include the following:

  • A familiar development environment for .NET developers. Windows SharePoint Services 3.0 is built entirely on ASP.NET, so you use the same familiar .NET Framework and .NET languages, the same .NET Framework and ASP.NET class libraries, and the same development tools.

  • Built-in features that developers can extend. Windows SharePoint Services 3.0 adds foundational components that are valuable for creating Web-based applications such as a Web Part framework, data lists, document libraries, a workflow engine, and Web site templates. Office SharePoint Server 2007 adds major application features on top of Windows SharePoint Services 3.0. These include user site provisioning, business intelligence features, forms services, enterprise content management, integrated search, and social networking features. All of these features can be extended by developers to implement something as simple as a Web dashboard to a complex line-of-business (LOB) application.

  • The best integrated server for Office applications. If you need to store documents as part of your Web application, Office SharePoint Server 2007 is the answer. Office client applications including Word, Excel, Outlook and InfoPath can be easily used as part of an enterprise solution built on SharePoint.

  • The foundation for a wide variety of Intranet or Internet applications. For end users, SharePoint Products and Technologies have numerous easy-to-use and desirable features. For developers, SharePoint Products and Technologies is a platform to build on. Because when you develop on the SharePoint platform you are building on the same application foundation that SharePoint uses for end user functionality, the applications that you can create have a consistent common look, and can be managed in a consistent way. If a company already has SharePoint deployed, it is easy to add applications to the existing deployment.

What are SharePoint Products and Technologies?

SharePoint Products and Technologies provide a foundation for collaboration, business intelligence, enterprise content management, people and personalization services, Enterprise Search, integration of LOB data, and processes.

SharePoint Products and Technologies include the following:

  • Windows SharePoint Services 3.0. A set of services for collaboration and a foundation for building Web-based applications on Windows Server. Windows SharePoint Services 3.0 is included in Windows Server 2003 and in Windows Server 2008, and is also available separately as a download.

  • Microsoft Office SharePoint Server 2007. A single, integrated application that provides sites (locations) where employees can efficiently collaborate with team members, find organizational resources, search for experts and corporate information, manage content and workflow, and make use of business insight to reach better-informed decisions. Office SharePoint Server 2007 is part of the 2007 Microsoft Office system. For more information, see the Microsoft Office SharePoint Server 2007 frequently asked questions.

  • Microsoft Office SharePoint Designer 2007. A designer and developer tool that enables you to quickly build solutions that include both design and workflow.

Windows SharePoint Services 3.0 and Office SharePoint Server 2007 are built on top of the ASP.NET 2.0 Framework and the Microsoft .NET 3.0 Windows Workflow Foundation (WF) as shown in Figure 1.

Figure 1. SharePoint Products and Technologies

SharePoint Products and Technologies

Windows SharePoint Services 3.0

Windows SharePoint Services 3.0 is a technology that includes a set of tools for collaboration. These tools provide easy access to documents, content, people, and information. Windows SharePoint Services 3.0 also provides eight capabilities or services that enable developers to create rich and scalable Web-based applications, thus providing the means for collaboration. Following are the capabilities of Windows SharePoint Services 3.0 (see Figure 1).

  • Administration. The classes and features of the Microsoft.SharePoint.Administration namespace provide administrators with the tools and means for deploying, migrating, maintaining, and administrating their SharePoint sites and SharePoint-based solutions. For more information, see the Windows SharePoint Services Administration Resource Center.

  • Data management. Windows SharePoint Services 3.0 provides an intuitive, robust environment for data collaboration and storage. It includes a range of ways to manage the content and metadata of your important business documents and data. Integrated property promotion and demotion maintain synchronization between metadata in Windows SharePoint Services and the metadata in the Office documents.

  • Information services. Information services in Windows SharePoint Services 3.0 include inbound e-mail, e-mail alert notifications, and search. These features help teams to stay connected and productive by providing easy access to the people, documents, and information. Windows SharePoint Services can help users make well-informed decisions and get work done.

  • Pages and user interface (UI). The page model in Windows SharePoint Services 3.0 is built on top of ASP.NET 2.0. This creates dynamic new ways to customize and manage page design. The SharePoint pages viewed in the browser are constructed through the control templates of master pages and .ascx files. You can create custom templates that override the default templates, or programmatically modify the menus, treeviews, and navigational areas that are displayed on pages. For more information, see the Windows SharePoint Services Pages and User Interface Resource Center.

  • Provisioning. When you create a list or a site, a definition or a template determines how the list or site will be instantiated. Unlike a traditional ASP.NET application, a physical ASPX page does not need to exist for every page on the server. Windows SharePoint Services treats any page that is not customized as a virtual file, which can allow a small number of files to appear in many places. You can learn more about how this works in Understanding and Creating Customized and Uncustomized Files in Windows SharePoint Services 3.0. A definition or template determines, for example, the lists, files, Web Parts, Features, or settings with which to provision the new list or site. For more information, see the Windows SharePoint Services Provisioning Resource Center.

  • Security. Security features of Windows SharePoint Services 3.0, and the underlying ASP.NET 2.0 and .NET Framework 3.0, help give you protection from unauthorized changes to your data, whether deliberate or inadvertent, and help ensure that sensitive information is available only to those authorized to see it. SharePoint Products and Technologies help provide a secure platform by integrating with Microsoft Internet Information Services (IIS) and Windows Server to provide authentication and authorization mechanisms. For more information, see the Windows SharePoint Services Security Resource Center.

  • Web Parts. Web Parts in Windows SharePoint Services provide developers with a way to create UI elements that support both customization and personalization. A site owner or a site member with the appropriate permissions can customize Web Part Pages by using a browser or Microsoft Office SharePoint Designer 2007 to add, reconfigure, or remove Web Parts. For more information, see the Windows SharePoint Services Web Parts Resource Center.

  • Workflow. Workflows implement custom business processes that you can attach to SharePoint documents and list items. You can use workflows to control almost any aspect of an item in Windows SharePoint Services, including the life cycle of that item. For more information, see the xx.

Windows SharePoint Services 3.0 and Office SharePoint Server 2007 provide a managed object model that enables you to programmatically customize SharePoint sites. You can integrate this object model into your ASP.NET application to enable programmatic access to documents, content, people, and information from your application. For more information, see Programming in Windows SharePoint Services.

Microsoft Office SharePoint Server 2007

Microsoft Office SharePoint Server 2007 is a server product that builds on the Windows SharePoint Services 3.0 technology. It provides a consistent, familiar framework for lists and libraries, site administration, and site customization. Additionally, Office SharePoint Server 2007 allows you to:

  • Conduct effective searches for people, documents, and data.

  • Participate in forms-driven business processes.

  • Access and analyze large amounts of business data.

Office SharePoint Server 2007 also allows you to create Web-based solutions and sites that support specific content publishing, content management, records management, or business intelligence needs. Office SharePoint Server 2007 provides built-in components to help you create rich Web-based solutions. As a result, Office SharePoint Server 2007 can greatly reduce the development time and provide enterprise-scale capabilities to meet business-critical needs.

Figure 2 shows the capabilities of Office SharePoint Server 2007.

Figure 2. Office SharePoint Server 2007 capabilities

Office SharePoint Server Capabilities

Office SharePoint Server 2007 provides six capabilities or services that enable developers to customize and extend rich and scalable Web-based applications, as follows:

  • Collaboration and social computing. Office SharePoint Server 2007 provides Web Parts that enable functionality for social computing, wikis, blogs, RSS feeds, e-mail integration, and task coordination. All of these components use information about your organization, communities, and electronic communications in Public My Site pages to help establish connections between colleagues with common interests. For more information, see Collaboration Help and How-to.

  • Portals. Office SharePoint Server 2007 is a world class enterprise portal platform that makes it easy to build and maintain portal sites for every aspect of your business. It provides built-in My Site personal sites, content syndication, user profiles and a profile store, audience targeting, mobile device support, portal site templates, document aggregation Web Parts, and more. For more information, see Developer-Oriented Videos on Building Portals.

  • Enterprise Search. Enterprise Search in Microsoft Office SharePoint Server 2007 provides extensive and extensible content gathering, indexing, and querying ability. This service supports full-text searching by using a Structured Query Language (SQL-based) query syntax, and provides a new keyword syntax to support keyword searches. For more information, see the Enterprise Search Resource Center for SharePoint Server.

  • Enterprise content management. Enterprise content management (ECM) features provide ways to manage the content and metadata of business documents stored in Office SharePoint Server 2007 document libraries. ECM is a key infrastructure component that can help companies manage and organize high volumes of unstructured content such as forms, documents, records, e-mail messages, videos, instant messages (IMs), and Web pages. For more information, see the Enterprise Content Management Resource Center for SharePoint Server.

  • Business process and forms. Office SharePoint Server 2007 provides built-in electronic forms and workflow templates. InfoPath Forms Services, included in Office SharePoint Server 2007, enables you to publish InfoPath form templates, designed in Microsoft Office InfoPath 2007, to Office SharePoint Server 2007 as ASP.NET Web applications. You can open these in your browser to provide a similar experience to filling out and editing a form in InfoPath. For more information, see the InfoPath Forms Services Resource Center for SharePoint Server. In addition, Office SharePoint Server 2007 provides built-in workflows for document approval, feedback collection, signature collection, and disposition approval, and three-state workflows and a translation management workflow. You can also write custom code to create, maintain, and analyze custom workflows, enabling you to streamline your business processes. For more information, see the Workflow Resource Center.

  • Business intelligence. Office SharePoint Server 2007 provides infrastructure to create dashboards that allows decision-makers to access information. Excel Services server technology, included in Office SharePoint Server 2007, is a shared service that enables you to load, calculate, and display Excel workbooks on Office SharePoint Server 2007. You can use the Excel Services programmability framework to extend Microsoft Office Excel 2007 and Excel Services functionalities to work with Office SharePoint Server 2007 lists, query tables on Excel Services, external workbook references, SQL write-back, and user-defined functions (UDFs). For more information, see the Excel Services Resource Center. Additionally, the Business Data Catalog functionality in Office SharePoint Server 2007 enables you to present LOB data within Office SharePoint Server. By using the Business Data Catalog, you can bring key data from different business applications to SharePoint lists, Web Parts, search, user profiles, and custom applications. The Business Data Catalog allows you to pull data from Microsoft SQL Server, Oracle, Microsoft Office Access, or other databases by using a connection string. It also allows you to pull business data from back-end server applications such as SAP, Siebel, or other LOB systems by using Web services. You can use the Business data catalog metadata model to define an LOB entity and the Administration Object Model to manage metadata programmatically. For more information, see the Business Data Catalog Resource Center for SharePoint Server.

Note You can use multiple APIs and Web services to customize and extend Office SharePoint Server 2007. For a complete list of Office SharePoint Server 2007 classes and namespaces, see the Class Library and Web Service Reference in the Microsoft Office SharePoint Server 2007 SDK.

For more information, see Microsoft Office SharePoint Server 2007 Capabilities.

Microsoft Office SharePoint Designer

Microsoft Office SharePoint Designer 2007 is a developer tool specifically designed to enable you to build and customize SharePoint sites, workflow-enabled applications, and reporting tools. It provides a WYSIWYG design interface, developer environment, and easy-to-use development tools that help simplify the task of building sites and applications. ASP.NET developers can take advantage of their existing knowledge and use this tool to create, view, and modify ASP.NET pages. The WYSIWYG design interface provides precise rendering of Extensible Hypertext Markup Language (XHTML) code, cascading style sheets (CSSs), and ASP.NET technologies. This tool also provides Microsoft IntelliSense support, Web Parts, and ASP.NET controls.

Additionally, you can use Office SharePoint Designer 2007 to define and control page layout and design, master page creation, list or content type design, creation of sample data, Web Part page creation, Web Part hookup, no-code data views or forms, and no-code workflows.

Using this tool you can easily create SharePoint applications that contain custom list views, forms, data from external sources, and workflows without writing server-side code. Some of the data sources you can use to present data in your SharePoint solutions include SharePoint lists, XML files, SOAP services, server scripts, SQL databases (such as from SQL Server 2005), RSS feeds, and Web services. For more information, see the SharePoint Designer Developer Center.

Building SharePoint Solutions Using Visual Studio 2008

Visual Studio 2008 includes enhancements for faster development with the .NET Framework 3.5. These enhancements include visual designers, substantial improvements to Web development tools, and language enhancements that speed development with all types of data. Visual Studio 2008 enables organizations of every size to rapidly create more secure, manageable, and reliable applications that take advantage of Windows Vista and the 2007 Office system.

Visual Studio Tools for the Office System (3.0) and Workflow Support

As a fully integrated component of Visual Studio 2008, Visual Studio Tools for the Office system (3.0) offers wider support to extend applications in Microsoft Office 2003 and the 2007 Microsoft Office system by using Microsoft Visual Basic and Microsoft Visual C#. Visual Studio Tools for the Office system (3.0) supports, reduces the complexity of, and speeds the creation of SharePoint workflows to help manage business process and information flow. For more information, see Building Office Business Applications Using Visual Studio Tools for the Office System (3.0).

Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.2

Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.2 is an add-on to Visual Studio 2008 that makes it easier to code SharePoint solutions. It includes a set of Visual Studio project templates for Web Parts and site definitions, and a stand-alone utility program—the SharePoint Solution Generator. For more information, see Announcing the Final Release of VSeWSS 1.1 (and the upcoming version 1.2). Then download the Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.2.

Figure 3 shows the different Visual Studio project templates enabled by Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.2.

Figure 3. Visual Studio project templates enabled by Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.2

VSE for WSS project templates

Visual Studio 2008 or SharePoint Designer?

Office SharePoint Designer 2007 offers seamless integration with Windows SharePoint Services 3.0 and Office SharePoint Server 2007. Therefore, it is the preferred tool for those who want to build SharePoint applications or to design and customize SharePoint sites quickly, efficiently, and without writing code. However, if you need more flexibility, you can also use Visual Studio 2005 or Visual Studio 2008 to customize and extend SharePoint sites. For more information, see Getting Started with Programmatically Customizing a SharePoint Web Site in Visual Studio.

Many developers use both SharePoint Designer and Visual Studio. SharePoint Designer simplifies the design tasks, and Visual Studio provides a stronger environment for authoring custom code.

SharePoint Terminology

To help you familiarize yourself with the SharePoint vocabulary in this article, we define the terms used and give you additional resources to review:

  • Application page. Allows the use of inline custom code. Application pages or "_layout" pages are stored on the SharePoint Web server and made available via a Microsoft Internet Information Services (IIS) virtual directory. Though application pages behave much like other ASPX pages and allow the use of inline custom code, they differ from content pages in that they cannot be used to host SharePoint features such as dynamic Web Parts and Web Part zones. For more information, see Creating an Application Page in Windows SharePoint Services 3.0.

  • Content type. A reusable collection of settings to apply to a certain category of content such as documents and folders. Content types are designed to help users organize their SharePoint content in a more meaningful way. For more information, see Introduction to Content Types.

  • Custom action. Represents a link, toolbar button, menu item, or any control that can be added to a toolbar or menu that appears in the UI. You define custom actions by using a custom action element within a feature definition file. You can bind custom actions to a list type, content type, file type, or programmatic identifier (ProgID). For more information, see Custom Action Definitions.

  • Event receiver. Evaluator of an event and definer of the behavior of an application. Windows SharePoint Services 3.0 allows you to define event handlers within libraries, lists, and sites. Event receivers can be defined by using a receiver element within a feature definition file. For more information, see Event Registrations.

  • Feature. A package of Windows SharePoint Services elements that can be activated for a specific scope and that helps users accomplish a particular goal or task. Windows SharePoint Services 3.0 introduces this inherently portable and modular functionality, which simplifies modification of sites through site definitions. For more information, see Working with Features.

  • Master page. Pages that provide a consistent layout and appearance (look and feel) for SharePoint sites. They allow you to factor out layout, structure, and interface elements such as headers, footers, navigation bars, and content placeholders. Master pages in ASP.NET 2.0 and master pages in Windows SharePoint Services work in the same way. For more information, see Building Simple Master Pages for Windows SharePoint Services 3.0.

  • Module. A file or collection of file instances that define the location where the files are installed during site creation. Modules are frequently used to implement a Web Part Page in the site. You can define modules by using a module element within a feature definition file. For more information, see Modules.

  • SharePoint site: A Web site hosted in a virtual URL. A SharePoint site is a place for collaboration, communication, or content storage. Depending on your business needs, you can create sites such as team sites, blog sites, wiki sites, and others. You can customize a site's appearance, users, user permissions, galleries, and site administration by using the Site Settings administration pages.

  • SharePoint site collection: A collection of SharePoint sites that share common administration pages and site settings. Site collections allow you to share content types, site columns, templates, and Web Parts within a group of SharePoint sites.

  • SharePoint Web farm: A group of Office SharePoint 2007 servers that share the same configuration database. All site content and all configuration data is shared for all front-end Web servers in a server farm.

  • Site definition. A set of files that includes a master XML configuration file that is stored on all front-end Web servers. A site definition provides the basic blueprint for how sites look, what lists they include, their default navigational structures, and so on. For more information, see Working with Site Templates and Definitions.

  • Site template. A package containing a set of differences and changes from a base site definition that is created through the UI or through implementation of the object model. The site template package is stored as a .cab-based file that can be downloaded or uploaded to site collections by users with the appropriate rights. Site templates offer a measure of portability to SharePoint applications. For more information, see Working with Site Templates and Definitions.

  • Solution. A file that is a bundling of all the components for extending Windows SharePoint Services in a particular way. A solution file has a .cab-based format with a .wsp extension. A solution is a deployable, reusable package that can contain a set of Features, site definitions, and assemblies that apply to sites, and that you can enable or disable individually. You can use the solution file to deploy the contents of a Web Part package, including assemblies, class resources, and other package components. For more information see, Solution Overview.

  • Theme. A group of files (CSS, images) that allow you to define the appearance (look and feel) of Web pages. Themes in ASP.NET 2.0 and themes in SharePoint Products and Technologies work in the same way. Themes are used to help organizations to brand their portals and team sites. Office SharePoint Server 2007 includes a set of predefined themes. However, as a developer, you can create custom themes for your company. For more information, see How to: Customize Themes.

Components Used to Build Enterprise Solutions

SharePoint Products and Technologies offer a wide variety of development possibilities. As explained earlier, SharePoint Products and Technologies offer built-in capabilities that enable collaboration and social computing, an enterprise portal platform, enterprise search, ECM, business process and forms, and business intelligence. The .NET Framework provides a set of tools that allow you to customize and extend these capabilities. As a .NET developer, you will find the set of components used to build enterprise solutions compelling. The following section of this article introduces you to different developer components or solution artifacts that you can use to get started with SharePoint development.

Web Parts

As we explained earlier, you can build SharePoint Web Parts just as you build Web Parts in ASP.NET. But in addition, site administrators can deploy your Web Parts to SharePoint sites. As part of a SharePoint site, your SharePoint Web Part is immediately available to end-users to add to pages or use to personalize pages.

For example, let's say you create a custom ASP.NET Web Part that displays driving directions based on a custom start point property that users can personalize. To create this Web Part, you create a custom class library project that contains a control that inherits from the System.Web.UI.WebControls.WebParts.WebPart class. In this class, you override the CreateChildControls method to control the rendering of HTML. After you finish the code of the class, you compile the project and add a reference to the Web Part project's .dll in your Web project. Finally, to display your Web Part in a Web Form, you add the control to a Web Part zone.

One advantage of developing ASP.NET Web Parts is that you can reuse them in SharePoint sites. Figure 4 shows a custom driving directions Web Part running in an ASP.NET 2.0 Web page and in a SharePoint site. Another advantage is that you can create Web Parts that provide a complete set of Windows SharePoint Services features, such as document services, events, workflow, search, site columns, content types, and more.

Figure 4. Custom Web Part running in ASP.NET 2.0 pages and a SharePoint site

Custom Web Part

For more information, see Working with ASP.NET 2.0 Web Parts and Windows SharePoint Services 3.0.

Data Lists

Windows SharePoint Services enables you to create lists and customize them to include specific columns of information. A list consists of items or rows, and columns or fields that contain data. With ASP.NET you must create or get access to a SQL Server database, and then create the tables and columns you need. Then, you have to build UI components to allow the users to populate the columns with this data. Windows SharePoint Services provides a user friendly foundation for managing data structures in the form of lists, and for doing data entry into these data structures.

Let's examine a scenario in which you are a consultant tracking many different development projects. Your manager asks you to create a custom list of projects and share the list by using intranet resources. Because your company has a SharePoint site, you decide to create a custom list that displays the title, delivery date, status, documentation, owners, and cost of each project. Figure 5 shows a custom "Projects" list.

Figure 5. Custom "Projects" list

Custom Projects List

Having this list in a SharePoint site allows you to share project information with your co-workers. Better yet, as a developer you can access data stored in this list programmatically. Windows SharePoint Services 3.0 provides a set of Web services and classes that allow users to access data from SharePoint lists.

In another scenario, you might want to create an ASPX page with a label control that returns items from the "Projects" list where values in the "Cost" field are greater than $5,000. You can display this information by adding the Microsoft.SharePoint namespace and Microsoft.SharePoint.Utilities namespace to the class code-behind file. Additionally, you need to write some code that can access the data stored in the "Projects" list, as shown in the following code example.

protected void Page_Load(object sender, EventArgs e) {
    if (!IsPostBack){
        SPWeb oWeb = SPContext.Current.Web;
        SPList oList = oWeb.Lists["Projects"];

        SPQuery oQuery = new SPQuery();
        oQuery.Query = "<Where><Gt><FieldRef Name='Cost'/>" +
        "<Value Type='Number'>5000</Value></Gt></Where>";
        SPListItemCollection collListItems = oList.GetItems(oQuery);

        StringBuilder sb = new StringBuilder();
           // The indenting of the following lines of code has been
           // modified for readability. Please modify as 
           // needed.
        foreach (SPListItem oListItem in collListItems){
                sb.Append("Item: ");
sb.Append(SPEncode.HtmlEncode(Convert.ToString(oListItem["Title"])));
                sb.Append("::Value: ");
sb.Append(SPEncode.HtmlEncode(Convert.ToString(oListItem["Status"])));
                sb.Append("::Calculated: ");
sb.Append(SPEncode.HtmlEncode(ConvertToString(oListItem["Cost"])));
                sb.Append("<BR>");        }
    }
        Label1.Text = sb.ToString();
}

For more information, see Lists (How Do I... in Windows SharePoint Services).

Event Handlers (Also Known as Event Receivers)

Windows SharePoint Services allows you to programmatically create, manage, and retrieve information from documents libraries and lists. Additionally, you can create receiver classes that handle both synchronous and asynchronous events. It is possible to hook up and override multiple event handler assemblies from your custom lists, document libraries, sites, and user operations. This gives you the power of SQL triggers on SharePoint lists.

For example, let's say you want to avoid user deletion of items from a custom "Projects" list. To handle this event, you must override the ItemDeleting event of a list definition. Each time a user tries to delete an item, the user should receive a message. The following code example shows how to override the ItemDeleting event handler. This event receiver will prevent attempts at deleting items—even from users that have delete permission on the list.

public override void ItemDeleting(SPItemEventProperties properties)
{
    properties.Cancel = true;
    properties.ErrorMessage = "Deleting is not supported in this list.";
}

For more information, see Event Fundamentals.

Workflows

Workflows allow you to streamline individual tasks and coordinate business processes. Using ASP.NET, you can build a set of Web forms to submit data and initiate workflows. However, you have to write a lot of business logic code to automate a workflow. Fortunately, SharePoint Products and Technologies offer built-in support for workflow customizations.

Windows SharePoint Services 3.0 provides support to create document-oriented workflow solutions. You can associate workflows to lists, document libraries, or content types. Because Windows SharePoint Services 3.0 workflows are associated to the data that humans manage, it allows you to integrate a human dimension to your workflow solutions. You can define a set of approvers and users who perform the tasks on a workflow instance.

The Microsoft.SharePoint.Workflow namespace provides a set of classes, interfaces, and enumerations that represent workflow functionality encapsulated in Windows SharePoint Services 3.0.

Workflow solutions may or may not have input forms that allow end users to interact with workflows. You can use ASP.NET Web forms to define any of the following kind of workflow forms:

  • Association form. Allows you to define the name of and data associated with the workflow when connecting it to a document library, list, or content type.

  • Initiation form. Allows you to specify information about the specific workflow instance for an item when a workflow instance starts. This form is presented to end-users only when a workflow is started manually.

  • Task forms. Allows you to control the display of tasks associated with a workflow and define special processing when editing a task. This set of forms is implemented with the content type functionality that allows you to display, edit, and customize new forms for any content type.

  • Modification form. Allows you to control the state and flow of a workflow by using custom pages, which can manipulate the data that the workflow is using.

  • Status form. Allows you to define a custom status page to display to the user when the user checks the status of the workflow. This page can reach into other systems to correlate the SharePoint workflow with the data from other systems.

Office SharePoint Server 2007 provides additional enhancements for document-oriented workflows. Some of these capabilities include:

  • Support for using InfoPath forms through InfoPath Forms Services for any association, initiation, task, modification, or status form.

  • Customizable built-in workflows for approval and review.

For more information, see Developer Introduction to Workflows for Windows SharePoint Services 3.0 and SharePoint Server 2007.

To create workflow solutions, you can use Visual Studio 2005, Visual Studio 2008, or Office SharePoint Designer 2007.

Office SharePoint Designer 2007 provides support for simple rules-based workflows. It allows you to define workflows without writing custom code and simplifies the deployment process by automatically storing workflow markup, rules, and supported files in a specific document library. You can associate Office SharePoint Designer 2007 workflows with multiple document libraries or lists.

However, Visual Studio 2005 and Visual Studio 2008 provide a set of custom workflow templates that allow a greater level of customization. Both development environments provide a basic activity library that contains a set of predefined activities you can use to define workflows. You can also create custom activities that you can reuse in different workflow solutions. For example, you can create a custom activity to add workflow steps as tasks in Microsoft Office Outlook 2007. Figure 6 shows SharePoint Sequential Workflow and SharePoint State Machine Workflow templates in Visual Studio 2008.

Figure 6. Workflow templates in Visual Studio 2008

Workflow templates in Visual Studio 2008
Cc537498.note(en-us,office.12).gifNote:

Visual Studio developed workflow templates are deployed via Features and solutions. These workflow templates can be reused between libraries in the same site collection, among sites in the same Web application, and even across sites in different SharePoint farms.

For more information, see SharePoint Workflow Solutions.

Silverlight in Web Parts

Microsoft Silverlight is a cross-browser, cross-platform, and cross-device plug-in for delivering the next generation of .NET Framework–based media experiences and Rich Internet Applications (RIAs) for the Web. For more information, see ASP.NET Previews.

Silverlight offers improved interactive experiences for Web-based applications. For that reason, .NET-technology developers are interested in providing Silverlight features and components for new Web-based solutions. SharePoint developers can also take advantage of Silverlight in their SharePoint-based solutions.

Silverlight UI elements can help you integrate rich interactive functionality in SharePoint sites. You can create Web parts, document libraries, picture libraries, navigation, and custom field types that provide Silverlight support on SharePoint sites.

The Microsoft Silverlight Blueprint for SharePoint provides source code and guidance for developers that describe how to use Silverlight and Microsoft SharePoint Products and Technologies together in business applications and Internet Web sites. This capability enables a fresh look at data exposed through SharePoint Products and Technologies by using the latest graphics capability in Silverlight. Figure 7 shows a Silverlight Picture Viewer sample hosted in an ASP.NET 2.0 Web Part that is running on the SharePoint Platform.

Figure 7. Silverlight picture viewer sample

Silverlight picture viewer sample

For more information, see Microsoft Silverlight Blueprint for SharePoint.

Page Branding

Windows SharePoint Services 3.0 and Office SharePoint Server 2007 include a set of built-in templates, master pages, and CSSs that allow you to customize the appearance (look and feel) of SharePoint sites.

The ASP.NET page framework provides a set of features that enable you to create and enhance the look and feel of Web applications. Some of these features include the following:

  • Master pages. Determine overall layout, structure, and interface elements with master pages (described earlier in this article). Use master pages to provide a consistent layout for Web sites you develop.

  • Styles. Define rich design through CSSs and the style property of standard HTML tags, HTML controls, and Web controls.

  • Themes. Define the look and feel of Web pages by using a group of files (CSS and images) that compose a theme.

Because SharePoint Products and Technologies use ASP.NET 2.0 as a platform and framework, you can also modify master pages, CSSs, and images of a SharePoint site for branding purposes.

In Office SharePoint Server 2007, master pages are stored in the Master Page Gallery. Windows SharePoint Services exposes the Master Page Gallery as a document library that stores all existing master page definitions of a site collection. You can explore the contents of the Master Page Gallery and modify the built-in templates to create custom master pages as you need. Figure 8 shows a branded SharePoint site that uses a master page.

Figure 8. Branded SharePoint site

Branded SharePoint site
Cc537498.note(en-us,office.12).gifNote:

The default.master file contains controls such as ASP.NET server and user controls and SharePoint framework controls such as SPWebPartManager, SiteActions, SiteLogoImage, and CSSLink.

For more information, see Customizing and Branding Web Content Management-Enabled SharePoint Sites (Part 1 of 3): Understanding Web Content Management and the Default Features.

Page Navigation

ASP.NET 2.0 provides a site navigation model that includes a site navigation API, a set of navigation providers, and server controls that allow you to control site navigation programmatically. The Site Navigation API has a SiteMapProvider class you can use to store your navigational data. You can then author a custom provider that derives from the SiteMapProvider class to retrieve other data stores that use other formats.

Office SharePoint Server 2007 provides the PortalSiteMapProvider class that derives from the ASP.NET SiteMapProvider class. The PortalSiteMapProvider class, in the Microsoft.SharePoint.Publishing namespace, allows you to retrieve site hierarchy data. Therefore, you get enhanced navigation control on SharePoint sites.

ASP.NET also provides a set of navigation controls such as the SiteMapPath, TreeView, and Menu controls. These controls allow you to provide graphical site navigation in your Web sites. In the same way, Office SharePoint Server 2007 uses the Microsoft.SharePoint.WebControls.AspMenu control to provide menu-based navigation. By following the same approach you use for ASP.NET Web sites, you can programmatically customize navigation of SharePoint sites.

Finally, ASP.NET also provides data source controls that allow you to connect navigation controls with the underlying provider of navigation data. Office SharePoint Server 2007 provides the PortalSiteMapDataSource control that lets you link navigation controls to navigation data via the DataSourceID attribute of navigation controls. Therefore, you can use a PortalSiteMapDataSource control in the same way you use a SQLDataSource, an XMLDataSource, an AccessDataSource, or an ObjectDataSource Web server control to bind navigation data to server controls such as a TreeView or Menu control.

Master pages in SharePoint Products and Technologies, such as the default.master page, are used to store page navigation providers and controls. The following sample code shows the partial contents of a default.master page that contains page navigation definitions encapsulated in an asp:ContentPlaceHolder control.

<asp:ContentPlaceHolder ID="PlaceHolderHorizontalNav" runat="server">
    <sharepoint:aspmenu
    id="TopNavigationMenu"
    runat="server"
    datasourceid="topSiteMap"
    enableviewstate="false"
    accesskey="<%$Resources:wss,navigation_accesskey%>"
    orientation="Horizontal"
    staticdisplaylevels="2"
    maximumdynamicdisplaylevels="1"
    dynamichorizontaloffset="0"
    staticpopoutimageurl="/_layouts/images/menudark.gif"
    staticpopoutimagetextformatstring=""
    dynamichoverstyle-backcolor="#CBE3F0"
    skiplinktext=""
    staticsubmenuindent="0"
    cssclass="ms-topNavContainer">
        <StaticMenuStyle/>
        <StaticMenuItemStyle CssClass="ms-topnav" ItemSpacing="0px"/>
        <StaticSelectedStyle CssClass="ms-topnavselected" />
        <StaticHoverStyle CssClass="ms-topNavHover" />
        <DynamicMenuStyle BackColor="#F2F3F4" BorderColor="#A7B4CE"
        BorderWidth="1px"/>
        <DynamicMenuItemStyle CssClass="ms-topNavFlyOuts"/>
        <DynamicHoverStyle CssClass="ms-topNavFlyOutsHover"/>
        <DynamicSelectedStyle CssClass="ms-topNavFlyOutsSelected"/>
    </sharepoint:aspmenu>
    <sharepoint:delegatecontrol runat="server"
    controlid="TopNavigationDataSource">
        <Template_Controls>
            <asp:SiteMapDataSource
            ShowStartingNode="False"
            SiteMapProvider="SPNavigationProvider"
            id="topSiteMap"
            runat="server"
            StartingNodeUrl="sid:1002"/>
        </Template_Controls>
    </sharepoint:delegatecontrol>
</asp:ContentPlaceHolder>

For more information, see Customizing and Branding Web Content Management-Enabled SharePoint Sites (Part 2 of 3): Extending WCM.

Web Services

Web services allow your Web-based applications to connect to other software applications over a network, and therefore enable you to build distributed, service-oriented systems. As an ASP.NET developer, you may have already connected your Web-based applications to multiple Web services. If that's the case, you will be pleased to know that both Windows SharePoint Services and Office SharePoint Server offer a wide variety of Web services that you can use to retrieve and configure information from SharePoint sites.

Windows SharePoint Services Web Services

Windows SharePoint Services Web services are part of the Microsoft.SharePoint.SoapServer namespace. These Web services include methods for accessing and customizing SharePoint site content such as lists, site data, forms, meetings, document workspaces, and permissions. Figure 9 shows the various Windows SharePoint Services Web services.

Figure 9. Windows SharePoint Services Web services

Windows SharePoint Services Web services

To add a reference to a Windows SharePoint Services Web service in Visual Studio, add a Web Reference using the path of the SharePoint site for which the Web service is available. For example, to connect to the meetings Web service, you need to add a reference to the following: http://MyServer/[sites/][MySite/][MySubsite/]_vti_bin/meetings.asmx.

For more information, see Windows SharePoint Services Web Services.

Office SharePoint Server 2007 Web Services

Office SharePoint Server 2007 provides Web services to expose capabilities such as the Business Data Catalog, document management, Enterprise Search, Excel Services, InfoPath Forms Services, and Web content management (WCM). You can use multiple Web services to retrieve information and configure SharePoint sites. The following table lists the most commonly used Office SharePoint Server 2007 Web services.

Table 1. Commonly used Office SharePoint Server Web services

Web Service Description Reference

Excel Services Web Service

Provides a Web services interface to enable applications to access manipulate, and calculate data in workbooks.

ExcelService.asmx

InfoPath Forms Web Service

Provides the implementations of features that are used internally by InfoPath Forms Services.

FormsService.asmx

Official File Web Service

Provides methods for sending files.

officialfile.asmx

Published Links Web Service

Provides a published links interface for remote clients to read and create published links.

PublishedLinksService.asmx

Query Web Service

The Query Web service allows you to access Enterprise Search results from client applications and Web applications outside of the context of a SharePoint site.

search.asmx

User Profile Change Web Service

Provides a user profile interface for remote clients to read and create user profiles

UserProfileChangeService.asmx

User Profile Web Service

Includes methods to manage user profiles

UserProfileService.asmx

Workflow Web Service

Provides a workflow interface remote clients can use to perform actions such as getting information about workflow for an item or workflow task, starting a workflow, or getting workflow templates.

workflow.asmx

You add a reference to an Office SharePoint Server Web service in Visual Studio by adding a Web Reference that uses the path of the SharePoint site for which the Web service is available. For example, to connect to the Search Web service, you need to add a reference to the following: http://MyServer/[sites/][MySite/][MySubsite/]_vti_bin/search.asmx.

For more information, see Class Library and Web Service Reference.

Custom Content Types

As explained earlier in this article, content types are designed to help users organize their SharePoint content in a more meaningful way. A content type is a reusable collection of settings you can apply to a certain category of content, such as documents and folders. For example, you can define a custom purchase order document type. Windows SharePoint Services allows you to define custom columns to track metadata and behaviors such as workflow, forms, event handlers, and information policies that are specific to this document type. Additionally, you want to define a custom contract for external vendors and store it in the same document library. Content types enable you to store multiple types of content in the same document library or list. Content types are independent of a SharePoint list location. After you define a content type, you can use it throughout an entire site collection. Content types let you extend functionality by allowing you to define additional settings, custom workflows, and attributes.

You can create content types by using the UI in Office SharePoint Server 2007, by using the Windows SharePoint Services object model, or via a SharePoint Feature. The Microsoft.SharePoint namespace provides a SPContentType class that represents a site or list content type that you can use to retrieve information and manipulate a content type programmatically. The following code example shows how to add a Status field to an existing "Projects" content type.

SPWeb mySite = SPContext.Current.Web;
SPContentType contentType = mySite.ContentTypes["Projects"];
StringCollection values = new StringCollection();
sc.AddRange(new string[]{ "Not Started","On Track","Completed" });
contentType.Fields.Add("Status",SPFieldType.Choice, false, true, values);
contentType.Update();

For more information, see Content Types.

User Management

ASP.NET provides support for role-based authentication. This allows you to programmatically control different access levels for users to Web pages. For example, you can have a Web site that has Web pages that can be seen only by managers, and Web pages that can be seen only by vice presidents. ASP.NET provides a set of different membership and role manager providers that allow you to customize and control authorization in your application.

In the same way, Office SharePoint Server 2007 allows you to define custom user profiles and audiences so you can control authorization to SharePoint sites. In addition, you can use user profiles and audiences to target content and information in content pages. For example, you can show or hide Web Parts in a content page based on audiences. Figure 10 shows how to define target audiences for a Web Part in content pages.

Figure 10. Define target audiences in Web Parts

Target audiences in Web Parts

User Profiles

In Office SharePoint Server 2007, user account property information is stored in a user profile store. Office SharePoint Server 2007 can import user profile information from Active Directory and Lightweight Directory Access Protocol (LDAP) domain controllers. Additionally, Office SharePoint Server 2007 supports the import of user profile information stored in databases or enterprise applications, such as SAP or Siebel, through the Business Data Catalog. You can even schedule incremental or full regular imports to the user profile store. For more information, see Importing User Profiles.

After you define the source and populate the user profile store, you can access and configure user information programmatically by using either the object model classes in the Microsoft.Office.Server namespace, or the User Profile Web Service.

Audiences

In Office SharePoint Server 2007, you can define audiences and content targeting based on audience rules, SharePoint groups, and Microsoft Exchange Server distribution list (DL) memberships.

Office SharePoint Server 2007 also provides an Audience object model that allows you to target content programmatically. The Audience object model is implemented in the Microsoft.Office.Server.Audience namespace.

If you are building Web Part solutions, you can implement the IRuntimeFilter2 interface to control which Web Parts are rendered at run time. The selection of Web Parts is based on a set of arbitrary parameters that are stored in the AuthorizationFilter property of the Web Part base class.

For more information, see Targeting Content Using Audiences.

How to Learn and Get Started with SharePoint Products and Technologies

The Microsoft Developer Network (MSDN) provides multiple resources that can help you get started with SharePoint development. Among these resources, you can find training courses, e-learning courses, software development kits (SDKs), downloads, technical articles, community sites, MSDN forums, and developer roadmaps and posters. The SharePoint Server 2007 Developer Center and the Windows SharePoint Services Developer Center provide a compilation of many of these resources. You can use these Web sites as a starting point to find developer resources and learn how to develop solutions by using SharePoint Products and Technologies. The following table provides pointers to online and printed resources that can help you learn more about SharePoint Products and Technologies.

Table 2. Resources to help learn and get started with SharePoint Products and Technologies

Applies To Office SharePoint Server Windows SharePoint Services

Learn

Getting started resources

Online clinics and e-learning sites

SDKs

Microsoft Office SharePoint Server 2007 SDK

Windows SharePoint Services 3.0 SDK

Community sites

MSDN forums

Roadmaps and posters

In the coming months, you will find a new set of hands-on-labs and quickstarts that introduce you to the different SharePoint Products and Technologies components used to build enterprise solutions. All content will be accessible on this SharePoint Developer Site.

Conclusion

The professional NET developer can take advantage of SharePoint Products and Technologies to build components and enterprise solutions. Windows SharePoint Services 3.0 uses the ASP.NET 2.0 framework to take advantage of features such as master pages and custom Web Part development. In addition, Windows SharePoint Services provides its own complete set of features, such as document services, events, workflows, search, site columns, and content types.

Office SharePoint Server 2007 provides a single, integrated location where employees can efficiently collaborate with team members, find organizational resources, search for experts and corporate information, manage content and workflow, and take advantage of business insight to make better-informed decisions.

Developers experienced with the .NET Framework can take advantage of the built-in features and capabilities offered by SharePoint Products and Technologies to expand their existing knowledge, and build enterprise-scale Web-based solutions to reach the growing SharePoint audience.

Acknowledgments

We want to thank Karthik Ravindran, Andrew Connell, Robert L. Bogue, and Beck Andros for their contributions to this article.

Additional Resources

Community Additions

ADD
Show:
© 2015 Microsoft