Olaf Feldkamp Developer Platform Advisor Microsoft Switzerland blogs.msdn.com/swiss_dpe_team.

43
Developing Web Applications on WSS Olaf Feldkamp Developer Platform Advisor Microsoft Switzerland blogs.msdn.com/swiss_dpe_ team

Transcript of Olaf Feldkamp Developer Platform Advisor Microsoft Switzerland blogs.msdn.com/swiss_dpe_team.

Developing Web Applications on

WSS

Olaf FeldkampDeveloper Platform AdvisorMicrosoft Switzerlandblogs.msdn.com/swiss_dpe_team

Agenda

IntroductionWeb PartsSolution DeploymentListsPerformanceConclusion

Database Web Server (IIS)Windows Workflow

Foundation (.NET 3.0)

ASP.NET 2.0 (Web Parts, Personalization, Master Pages,

Provider Model for navigation, Membership, ..)

Windows Server 2003 or 2008 (with WSS SP1)

Enterprise Content Manage-

ment

Portal SearchInfoPath

Forms Services

Business Intelligenc

e

MOSS 2007

Colla-boration

Applications (Portal Solutions)

WSS 3.0

Storage

Security

Manage-ment

Site Model

APITopolog

y

Platform Services Search Server 2008

Express

ASP.NET AJAX

optional

SharePoint Technology Stack

WSS 3.0 SP1: Released last December

Download SP1 or special WSS 3.0 with SP1 slipstream (32 or 64-bit)For MOSS 2007 also install MOSS 2007 SP1SP1 includes

Support to run WSS/MOSS on Windows Server 2008ASP.NET AJAX compatibility and support for Web PartsNew STSADM operations and properties> 60 hotfixes

Also refreshes for WSS/MOSS SDKs availableDetails on SharePoint Product Group Blog

Web

Platform

Collaboration

Store

Doc Libs,Site Columns,Content Types,

Lists,Views,Events,

Versioning,Permissions

Site Templates,Pages,

Web Parts,Custom Field

TypesAPIs,

Web services,Features,Solutions

Announcements, Presence, Contacts, Calendar, Project Tasks, Wikis,Doc Libs, Office Integration, Surveys, Discussions, Blogs, RSS,

Mobility

The three Faces of WSS 3.0

Site Model: Site Definitions

WSS provisions SharePoint sites based on Site Definitions

configurations

WEBTEMP.XML

Example Configs:Team SiteBlank SiteBasic Meeting WorkspaceBlog

Located:12\Template\1033\XML

navigation bars

modules

list instances

standard views

default.aspx

feature references

ONET.XML(per Site Definition)

Located:12\Template\SiteTemplates\HelpDesk\XML

SCHEMA.XML(per List Template)

Located:12\Template\Features\AnnouncementsList\Announce

12\Template\Features\HelpDeskList\HelpDesk

Provisioning and Customizing a Site

demo

Why choosing WSS as a Dev Platform?

End users can create and customize applications to a certain extent without the need of a

Database or System admin, or Web developer

Increased productivity with existing elements

Auditing, ChangeLog, Search, Alerts, Web ServicesData lists and document libraries incl. events and RSS

Integration with Office ClientsScalable platform enables Software+Services scenariosLeverage existing .NET and ASP.NET skillsWeb 2.0 with ASP.NET AJAX and SilverlightCustomer may require „runs on SharePoint“

BPA SolutionsNeuchâtel

Easy CRM (WSS based)SharePoint ConsultingSharePoint Hosting

partner

Agenda

IntroductionWeb PartsSolution DeploymentListsPerformanceConclusion

ASP.NET 2.0Web Part ConnectionsWeb Part Properties, ..

WSS 3.0Recommended: use ASP.NET 2.0 Web PartsNo built-in support for treating user controls (.ascx) as Web Parts

Use DelegateControl or custom shim

Compatibility for WSS 2.0 Web Parts

Web Part Development

WSS 3.0 Tools: VS 2005 Extensions 1.1

Released last month on MSDN, Visual Studio 2008 release planned for next June

Solution Package editingSharePoint Solution Generator

Content not supported: Some site and list templates, lookup fields, custom field types, some settings

Developing Web Parts with VSeWSS 1.1

Hello World Web Part and DebuggingWeb Part accessing custom DataWeb Part Properties

demo

More SharePoint Tools and Components

SharePoint workflow developmentWorkflow templates included in WSS SDK for Visual Studio 2005Visual Studio 2008 includes a rich development environment for MOSS 2007 workflows

>130 community SP projects: CodePlex.com

Solution Packaging and DeploymentSTSDEV, SharePoint Solution Installer, WSPBuilder

SharePoint Developer Explorer SmartPart for SharePointLINQ to SharePoint, ..

Install and Configure ASP.NET AJAX

Install ASP.NET AJAX 1.0 (or .NET FW 3.5)

Optional: Install ASP.NET AJAX Control ToolkitInstall on each Web Front End (WFE) Serverhttp://www.asp.net/ajax/

Modify web.config on each WFE ServerFollow the steps at http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3

Hint: Remember to add the ASP.NET AJAX <ScriptManager> to Master Page

Using the ASP.NET AJAX Extensions in your Web Parts

AJAX SmartPartSharePoint DelegateControl

demo

Silverlight Blueprint for SharePoint

http://www.ssblueprints.net/sharepoint/

Agenda

IntroductionWeb PartsSolution DeploymentListsPerformanceConclusion

Topology of Sites and the Object Model

Farm: ≥ 1 web and app servers (one config DB)Web Application: IIS web site extended with WSSSite Collection: stored in one specific content DB

SPFarm

SPVirtualServer

SPSite

SPWebSPWeb

SPWebS

PWeb

SPWeb

SPSite

SPWeb

Farm

Web Application

Site Collection

Top-level Site

Child Site

Ad

min

Con

tent

Config DB

Content DB

Feature NameID

DescriptionScope

Receiver assemblyActivation

DependenciesElement Manifests

Feature.xml

Elements.xml Custom Actions

Custom ViewsContent Type Definitions

Layouts PagesModules (files)List InstancesList Templates

Event ReceiversDelegate ControlsWorkflow Bindings

Modular Provisioning: Features

ScopeFarmWeb ApplicationSite CollectionWeb

Extend existing sites, instead of changing Site TemplatesCombination of lists, views,Web Parts, EventHandlers, ..

Implementing and Deploying a SharePoint Feature

demo

SharePointWeb Front End

Servers

Admin UI orstsadm.exe or

OM “deploy” cmd

retractdeploy

Solution Deployment

WSS Config

DBadddelete

stsadm.exeFilename.wsp(WSS Solution Cab)Feature Manifests

Template FilesAssemblies

Solution Information

Language packDeployment StatusDeployed to

Scheduled DeploymentChoose particular Web ApplicationWarns admin of GAC install

Solution Deployment using the UI

Agenda

IntroductionWeb PartsSolution DeploymentListsPerformanceConclusion

Querying Lists

Single-list query: SPQueryXML based (CAML Query)

Community Tool: Caml Query Builder can be helpful

New in WSS 3.0SPSiteDataQuery classCross-site, multiple list queriesIndexed fields

Important SPSiteDataQuery propertiesLists (the FROM)Query (the WHERE and ORDER BY)ViewFields (the SELECT)Webs (Site, SiteCollection or Recursive)

Running the querySPWeb.GetSiteData(SPSiteDataQuery)

Working with CAML within a Web Part

demo

LINQ and SharePoint

If you do a lot of list queries: evaluate LINQ to ObjectsLINQ is especially interesting when you need to join lists

var qry = from SPListItem cust in myCustomerList.Items join SPListItem docs in myDocLib.Items on (string)cust["Title"] equals (string)docs["Customer"]

select new { Customer = (string)cust["Title"], DocName = (string)docs[“DocName"], Year = (double)docs["FiscalYear"] };

List Events

Supported on regular lists as well as document librariesAccessing the current list item

prop.BeforeProperties (only doc libs)prop.AfterProperties

Synchronous and asynchronous list eventsMultiple handlers on a list

Item EventsSPItemEventReceiver

ItemAdded/ingItemAttachmentAdd/ingItemAttachmentDeleted/ingItemChecked/ingInItemChecked/ingOutItemDeleted/ingItemFileConvertedItemFileMoved/ingItemUnchecked/ingOutItemUnchecking/OutItemUpdated/ing

List EventsSPListEventReceiver

FieldAdded/ingFieldDeleted/ingFieldUpdated/ing

Web EventsSPWebEventReceiver

SiteDeleted/ingWebDeleted/ingWebMoved/ing

Item, List and Web Events

Implementing List Event Handlers with VSeWSS 1.1

demo

Agenda

IntroductionWeb PartsSolution DeploymentListsPerformanceConclusion

Performance

SPSite and SPWeb are managed wrappers (2 KB) to unmanaged classes (1 - 2 MB)Always use Dispose() or the using clause

Small managed objects don’t put pressure on garbage collector (GC) don’t rely on GC!

MSDN articles (must read!)Best Practices: Common Coding Issues When Using the SharePoint Object ModelBest Practices: Using Disposable Windows SharePoint Services Objects

Agenda

IntroductionWeb PartsSolution DeploymentListsPerformanceConclusion

Skills a SharePoint Developer Needs

ASP.NET 2.0Master Pages, ASP.NET Server and User Controls, ASP.NET Web Parts, ASP.NET Provider Model

Windows Workflow FoundationBuilding workflows, custom activities interacting with SharePoint

XML technologies (CAML)Used for queries and most schema definitions: Site Definitions, lists, fields, Content Types, ..

WSS 3.0 and MOSS 2007 APIs and Web ServicesMicrosoft (and 3rd party) developer tools for WSSSharePoint Features and SharePoint Solutions

Key Takeaways

WSS is a powerful platform for web based applicationsTools have started to ease development

{ Developers }Can take advantage of existing WSS elementsCan leverage existing .NET and ASP.NET skillsHave to learn a lot about SharePoint development

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. 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 provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Backup

The following slides were added to provide some useful additional information

Document and Data Store

GoalsUsable & Robust Document Management for the masses Powerful APIs

FeaturesPer-item securityVersioningRecycle bin (2-stage)List capacity improvements (width and length)List indexing and cross-list queriesContent Types and Site ColumnsForced Check-in/out for documentsEmbedded Windows Workflow Foundation

Content Types

Metadata – Collection of Site ColumnsDocument templateWorkflow SettingsParent Content TypeScopeMOSS 2007 only

Document InformationPanel SettingsPolicy Settings

Web Parts can be deployed to eitherthe GAC

+Assemblies run in any web app, must be signed+Assemblies run with Full Trust-IIS reset required after recompilation

or to the \bin directory of relevant web apps+Partial trust (WSS_Minimal or WSS_Medium)+Recommended for best security: Create a new trust policy file for each assembly, point your web.config file at the new file-More configuration needed

Web Parts including Security on MSDN

Web Part Security

Custom Field Types

ExamplesAHV field, Ext. data lookup

Base type it is inherited from (e.g. SPFieldText)

Defines the SQL storage and defaults like rendering

Field Type ClassDefines data validation

Field ControlsDefine rendering

Field TypeDefines field properties

Performance (2)

Assume a SPWeb.Webs collection consists of 10 subsites (1 - 2 MB) and you iterate through this collection

10 Users 50 Users 100 Users

250 Users

0

1,000

2,000

3,000

4,000

5,000

Memory usage [MB]

Best CaseWorst Case