OFC406 Windows SharePoint Services (version 3) Development 2: ASP.NET, Web Parts, Master Pages,...
-
Upload
erick-willis -
Category
Documents
-
view
219 -
download
0
Transcript of OFC406 Windows SharePoint Services (version 3) Development 2: ASP.NET, Web Parts, Master Pages,...
OFC406OFC406Windows SharePoint Services Windows SharePoint Services (version 3) Development 2: (version 3) Development 2: ASP.NET, Web Parts, Master ASP.NET, Web Parts, Master Pages, Field Types, and MorePages, Field Types, and More
OFC406OFC406Windows SharePoint Services Windows SharePoint Services (version 3) Development 2: (version 3) Development 2: ASP.NET, Web Parts, Master ASP.NET, Web Parts, Master Pages, Field Types, and MorePages, Field Types, and More
Ted PattisonTed PattisonResearcher and TrainerResearcher and TrainerTed Pattison GroupTed Pattison Group
AgendaAgenda
ASP.NET IntegrationASP.NET Integration
Page Templates vs. Page InstancesPage Templates vs. Page Instances
Master PagesMaster Pages
Web PartsWeb PartsNew ASP.NET Web Part ModelNew ASP.NET Web Part Model
Cross-site queryCross-site query
User controlsUser controls
Extensible Field TypesExtensible Field Types
Windows SharePoint Services Windows SharePoint Services 3.0 Terminology3.0 Terminology
FarmFarmThe highest-level scope for a Windows SharePoint Services The highest-level scope for a Windows SharePoint Services deploymentdeployment
An installation of one of more Web servers and back-end An installation of one of more Web servers and back-end serversservers
Each Windows SharePoint Services farm has one and only one Each Windows SharePoint Services farm has one and only one configuration DBconfiguration DB
Web Application (a.k.a. Virtual Server)Web Application (a.k.a. Virtual Server) An IIS Web site extended with Windows SharePoint ServicesAn IIS Web site extended with Windows SharePoint Services
Entry point capable of hosting 10,000s of site collectionsEntry point capable of hosting 10,000s of site collections
Site Collection (a.k.a. Site)Site Collection (a.k.a. Site)Unit of scale and ownership containing top-level siteUnit of scale and ownership containing top-level site
Stored in one specific content DBStored in one specific content DB
Site (a.k.a. Web)Site (a.k.a. Web)Many per site collectionMany per site collection
Uses same content DB as parent siteUses same content DB as parent site
Sites and Site CollectionsSites and Site Collections
Windows SharePoint Services manages Windows SharePoint Services manages sites in terms of site collectionssites in terms of site collections
Each Web Application can host one or more site Each Web Application can host one or more site collectionscollections
Each site collection has exactly one top-level siteEach site collection has exactly one top-level site
A site collection may (or may not) have child sitesA site collection may (or may not) have child sites
High-level Windows SharePoint High-level Windows SharePoint Services ArchitectureServices Architecture
Windows SharePoint Services data and Windows SharePoint Services data and content stored in SQL Servercontent stored in SQL Server
Configuration data stored in Configuration data stored in Windows SharePoint Services Windows SharePoint Services configuration databaseconfiguration database
Site content and Site content and customizations customizations stored in content stored in content databasesdatabases
Basic DB architecture Basic DB architecture remains unchanged remains unchanged from v2 to v3from v2 to v3
There are changes There are changes to undocumented to undocumented database schemasdatabase schemas
ASP.NET IntegrationASP.NET Integration
Windows SharePoint Services 3.0 far more Windows SharePoint Services 3.0 far more integrated with ASP.NETintegrated with ASP.NET
No more ISAPI filterNo more ISAPI filter
No more separate page parser for Windows SharePoint No more separate page parser for Windows SharePoint ServicesServices
Windows SharePoint Services 2.0Windows
SharePointServices 2.0
WindowsSharePoint
Services 3.0
ASP.NET 1.1
ASP.NET 2.0
Windows SharePoint Services 3.0
Moving from Windows SharePoint Moving from Windows SharePoint Services 2.0 to Windows SharePoint Services 2.0 to Windows SharePoint Services 3.0Services 3.0
Windows SharePoint Services v2 was built on Windows SharePoint Services v2 was built on ASP.NET 1.1ASP.NET 1.1
Windows SharePoint Services integrated more at the IIS level Windows SharePoint Services integrated more at the IIS level than at the ASP.NET levelthan at the ASP.NET level
ASP.NET 1.1 does offer way to parse .aspx files from databaseASP.NET 1.1 does offer way to parse .aspx files from database
ASP.NET 1.1 does not offer Web Part infrastructureASP.NET 1.1 does not offer Web Part infrastructure
ASP.NET 1.1 offers no satisfying page template solutionASP.NET 1.1 offers no satisfying page template solution
ASP.NET 1.1 offers no built-in navigation infrastructureASP.NET 1.1 offers no built-in navigation infrastructure
Windows SharePoint Services v3 is built on Windows SharePoint Services v3 is built on ASP.NET 2.0ASP.NET 2.0
Windows SharePoint Services integration in line with best Windows SharePoint Services integration in line with best practice ASP.NET extensibilitypractice ASP.NET extensibility
ASP.NET 2.0 provides parser for .aspx pages from databaseASP.NET 2.0 provides parser for .aspx pages from database
ASP.NET 2.0 provides new Web Part infrastructureASP.NET 2.0 provides new Web Part infrastructure
ASP.NET 2.0 offers Master Pages feature for page templatesASP.NET 2.0 offers Master Pages feature for page templates
ASP.NET 2.0 offers rich navigation infrastructureASP.NET 2.0 offers rich navigation infrastructure
SPVirtualPathProviderSPVirtualPathProvider
New pluggable component type for New pluggable component type for ASP.NETASP.NET
Allows Windows SharePoint Services to perform Allows Windows SharePoint Services to perform ghost/unghost detectionghost/unghost detection
Windows SharePoint Services hands .aspx files over to Windows SharePoint Services hands .aspx files over to ASP.NET for parsingASP.NET for parsing
PageParseFilter gives Windows SharePoint Services PageParseFilter gives Windows SharePoint Services control over compilationcontrol over compilation
Web Pages in Windows Web Pages in Windows SharePoint Services SitesSharePoint Services Sites
Windows SharePoint Services Sites have two kinds Windows SharePoint Services Sites have two kinds of pages (.aspx files)of pages (.aspx files)
Site pagesSite pages that can be customized on a per site basis that can be customized on a per site basis
Application pagesApplication pages that cannot be customized on a per that cannot be customized on a per site basissite basis
Site pages are initially uncustomizedSite pages are initially uncustomizedUncustomized version stored once on front-end Web Uncustomized version stored once on front-end Web serverserver
Uncustomized page also known as "ghosted" pageUncustomized page also known as "ghosted" page
Upon editing, customized site page stored in content DBUpon editing, customized site page stored in content DB
Application pages only live on front-end Web Application pages only live on front-end Web serverserver
Single copy of application page used for all Windows Single copy of application page used for all Windows SharePoint Services sitesSharePoint Services sites
Served out of the _layout virtual directoryServed out of the _layout virtual directory
The _layouts DirectoryThe _layouts Directory
_layouts directory provides common point for sites_layouts directory provides common point for sitesConfigured as virtual directory for all Windows SharePoint Configured as virtual directory for all Windows SharePoint Services Web applicationsServices Web applicationsC:\Program Files\Common Files\Microsoft Shared\C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTSweb server extensions\12\TEMPLATE\LAYOUTS
Provides standard relative URL for all sites in Web ApplicationProvides standard relative URL for all sites in Web Application/_layouts/SiteSettings.aspx/_layouts/SiteSettings.aspx
Used for Windows SharePoint Services system application Used for Windows SharePoint Services system application pagespages
Can also be used for custom application pagesCan also be used for custom application pages
Images directory configured in _layouts directoryImages directory configured in _layouts directoryUsed by Microsoft to deploy standard Windows SharePoint Used by Microsoft to deploy standard Windows SharePoint Services imagesServices images/_layouts/images/ALLUSR.GIF/_layouts/images/ALLUSR.GIF
Can also be used to deploy custom images/graphicsCan also be used to deploy custom images/graphics
Page Templates vs. Page Page Templates vs. Page InstancesInstances
Page templates live on Web server file Page templates live on Web server file systemsystem
They are defined inside site definitions and They are defined inside site definitions and featuresfeatures
They are used to create page instancesThey are used to create page instances
Page instances exist inside the scope of a Page instances exist inside the scope of a sitesite
Page instance initially ghosted when created Page instance initially ghosted when created from page templatefrom page template
Ghosted page is really a pointer back to page Ghosted page is really a pointer back to page templatetemplate
Uhghosted page stored inside content databaseUhghosted page stored inside content database
Page instance can be created without a Page instance can be created without a templatetemplate
Master PagesMaster Pages
Master Pages are a primary feature in Master Pages are a primary feature in ASP.NET 2.0ASP.NET 2.0
Provides effective template solution for pages within siteProvides effective template solution for pages within site
Content page reuses chrome from master pageContent page reuses chrome from master page
Content page fill in placeholders defined in master pageContent page fill in placeholders defined in master page
Windows SharePoint Services v3 embraces Windows SharePoint Services v3 embraces ASP.NET master pagesASP.NET master pages
Windows SharePoint Services sites such as Team Site Windows SharePoint Services sites such as Team Site built using a standard master pagebuilt using a standard master page
Quick and easy to change look and feel of entire siteQuick and easy to change look and feel of entire site
Editing master page can be done with SharePoint Site Editing master page can be done with SharePoint Site DesignerDesigner
Windows SharePoint Services Windows SharePoint Services Master Page ImplementationMaster Page Implementation
How do master pages work in Windows How do master pages work in Windows SharePoint Services?SharePoint Services?
Each site page in Windows SharePoint Services site Each site page in Windows SharePoint Services site “points” “points” to a master pageto a master page
Each Windows SharePoint Services site has a Master Each Windows SharePoint Services site has a Master Page Page Gallery (MPG)Gallery (MPG)
Site metadata tracks site-wide master Site metadata tracks site-wide master page page
Content pages (e.g., default.aspx) default to the per-site Content pages (e.g., default.aspx) default to the per-site MPGMPG
Form pages (e.g., allitems.aspx) default to the per-site Form pages (e.g., allitems.aspx) default to the per-site MPGMPG
Application pages hard-coded to master page in /_layoutsApplication pages hard-coded to master page in /_layouts
Editing a Master PageEditing a Master Page
Customizing Site PagesCustomizing Site Pages
Web PartsWeb Parts
Web Parts are used to build Web Parts are used to build portal-style applicationsportal-style applications
Content designed to modular, consistent and easy to Content designed to modular, consistent and easy to navigate navigate
Web Parts add in support for customization and Web Parts add in support for customization and personalizationpersonalization
Web Part HistoryWeb Part History
Microsoft Windows SharePoint Services 2.0 (WSS Microsoft Windows SharePoint Services 2.0 (WSS V2)V2)
Designed with its own Web Part infrastructureDesigned with its own Web Part infrastructure
Windows SharePoint Services serializes/stores/retrieves Windows SharePoint Services serializes/stores/retrieves personalization datapersonalization data
ASP.NET 2.0ASP.NET 2.0Designed with newer universal Web Part infrastructureDesigned with newer universal Web Part infrastructure
Serializes/stores/retrieves personalization dataSerializes/stores/retrieves personalization data
More flexible and more extensible than Windows SharePoint More flexible and more extensible than Windows SharePoint ServicesServices
ASP.NET 2.0 does not support Windows SharePoint Services v2 ASP.NET 2.0 does not support Windows SharePoint Services v2 Web PartsWeb Parts
Microsoft Windows SharePoint Services 2007 (WSS Microsoft Windows SharePoint Services 2007 (WSS V3)V3)
Supports Windows SharePoint Services V2 style Web PartsSupports Windows SharePoint Services V2 style Web Parts
Supports ASP.NET 2.0 style Web Parts (preferred)Supports ASP.NET 2.0 style Web Parts (preferred)
ASP.NET Web Part Page ASP.NET Web Part Page StructureStructure
Web Part Page in ASP.NET 2.0 is designed with…Web Part Page in ASP.NET 2.0 is designed with…One instance of WebPartManager classOne instance of WebPartManager class
One or more Web Part Zones One or more Web Part Zones
Optionally an Editor Zone and/or a Catalog ZoneOptionally an Editor Zone and/or a Catalog Zone
WebPartManager
WebPartZone (Left) WebPartZone (Right) Editor Zone
Catalog Zone
Web Part 1
Web Part 2
Web Part 3
Web Part 4
Web Part 5
Editor Part 1
Editor Part 2
Catalog Part 1
Catalog Part 2
ASP.NET 2.0 Web PartsASP.NET 2.0 Web Parts
Web Parts derive from WebPart base classWeb Parts derive from WebPart base classAll Web Part inherit common functionally All Web Part inherit common functionally
using System;using System.Web.UI;using System.Web.UI.WebControls.WebParts;
namespace LitwareWebParts {
public class HelloWorldWebPart : WebPart { protected override void OnPreRender(EventArgs e) { this.Title = "Litware Project Revenue"; }
protected override void RenderContents(HtmlTextWriter writer) { writer.Write("Hello, world"); } }}
Persistent Web Part PropertiesPersistent Web Part Properties
Web Parts support persistent propertiesWeb Parts support persistent propertiesPersistent personalization data tracked on per user basisPersistent personalization data tracked on per user basis
Persistent customization data tracked once for all usersPersistent customization data tracked once for all users
Persistent properties can be modified by user through Persistent properties can be modified by user through browserbrowserusing System;using System.Web.UI;using System.Web.UI.WebControls.WebParts;
namespace LitwareWebParts {
protected string _ZipCode; [ Personalizable(), WebBrowsable(true), WebDisplayName("Zip Code"), WebDescription("used to track user zip code") ] public string ZipCode { get{ return _ZipCode; } set{ value = _ZipCode; } } //... }
Windows SharePoint Services Windows SharePoint Services Web Part Page StructureWeb Part Page Structure
Web Part Page in Windows SharePoint Web Part Page in Windows SharePoint Services is designed with…Services is designed with…
One instance of SPWebPartManager controlOne instance of SPWebPartManager control
One or more Windows SharePoint Services-specific One or more Windows SharePoint Services-specific WebPartZone controls WebPartZone controls
Editor Zones and Catalog Zones supplied by WebPartPage base Editor Zones and Catalog Zones supplied by WebPartPage base classclass SPWebPartManager
WebPartZone (Left) WebPartZone (Right) Editor Zone
Catalog Zone
Web Part 1
Web Part 2
Web Part 3
Web Part 4
Web Part 5
Editor Part 1
Editor Part 2
Catalog Part 1
Catalog Part 2
Overview of Developing Web Overview of Developing Web PartsParts
Create a new class library DLL projectCreate a new class library DLL projectCreate a class that inherits from ASP.NET Web Part classCreate a class that inherits from ASP.NET Web Part class
Override methods as required (e.g. RenderContents)Override methods as required (e.g. RenderContents)
Deploy Web Part DLLDeploy Web Part DLLCompile DLL into \bin directoryCompile DLL into \bin directory
Configure DLL in web.config file SafeControl listConfigure DLL in web.config file SafeControl list
Import Web Part into a Windows Import Web Part into a Windows SharePoint Services site collectionSharePoint Services site collection
Add Web Part class to Web Part GalleryAdd Web Part class to Web Part Gallery
Add Web Part to zone on a Web Part PageAdd Web Part to zone on a Web Part Page
Web Part as a Safe ControlWeb Part as a Safe Control
Web Parts usually run on Web Part PagesWeb Parts usually run on Web Part PagesWeb Parts must be registered as Safe in web.config fileWeb Parts must be registered as Safe in web.config file
You must add entry to web.config before testing a Web You must add entry to web.config before testing a Web PartPart
<!– web.config in root directory of hosting virtual server -->
<configuration> <SharePoint> <SafeControls> <SafeControl Assembly="AcmeWebParts" Namespace="AcmeWebParts" TypeName="*" Safe="True" /> </SafeControls> </SharePoint></configuration>
Web Part Security CaveatsWeb Part Security Caveats
Web Parts loaded from \bin subject to security Web Parts loaded from \bin subject to security restrictionsrestrictions
Security restrictions controlled by Code Access Security (more Security restrictions controlled by Code Access Security (more later)later)
You might want to turn off security during developmentYou might want to turn off security during development
You can choose between three different built-in You can choose between three different built-in levelslevels
OSVR_MinimalOSVR_Minimal (default for Office Server) (default for Office Server)
WSS_MinimumWSS_Minimum (default for WSS V3) (default for WSS V3)
WSS_MediumWSS_Medium
FullFull
<!– web.config in root directory of hosting virtual server -->
<configuration> </system.web> <!-- <trust level="WSS_Minimal" originUrl="" /> --> <trust level="Full" originUrl="" />
</system.web></configuration>
The Web Part GalleryThe Web Part Gallery
Scoped to the Site Collection levelScoped to the Site Collection levelContains list of Web Parts available to place on pagesContains list of Web Parts available to place on pages
Web Parts declared as SafeControls can be auto-Web Parts declared as SafeControls can be auto-populatedpopulated
Click Click NewNew button on toolbar button on toolbar
Web Parts imported into gallery using .webpast filesWeb Parts imported into gallery using .webpast filesClick Click UploadUpload button on toolbar button on toolbar
Creating Web Parts for Windows SharePoint Services v3
Creating Web Parts for Windows SharePoint Services v3
Web Part Types for Windows Web Part Types for Windows SharePoint Services "V3"SharePoint Services "V3"
Windows SharePoint Services V3 supports Windows SharePoint Services V3 supports 3 different types of Web Parts3 different types of Web Parts
Windows SharePoint Services V2 RuntimeWindows SharePoint Services V2 Runtime
Windows SharePoint Services Web PartsWindows SharePoint Services Web Parts
Windows SharePoint Services V3 RuntimeWindows SharePoint Services V3 RuntimeASP.NET 2.0 RuntimeASP.NET 2.0 Runtime
ASP Web PartsASP Web PartsASP Web PartsASP Web Parts
Hybrid Web PartsHybrid Web Parts
Windows SharePoint Services Web PartsWindows SharePoint Services Web Parts
Windows SharePoint Services Web PartsWindows SharePoint Services Web Parts
Web Part Type in Windows Web Part Type in Windows SharePoint Services v3SharePoint Services v3
ASP.NET Web PartsASP.NET Web PartsWeb parts that inherit from ASP.NET WebPart Web parts that inherit from ASP.NET WebPart
Imported via .webpart filesImported via .webpart files
Preferred style for all new developmentPreferred style for all new development
Windows SharePoint Services v2-style Web Windows SharePoint Services v2-style Web partsparts
Web parts that inherit from Windows SharePoint Services Web parts that inherit from Windows SharePoint Services WebPart WebPart
Imported via .dwp filesImported via .dwp files
Supported mainly for backwards compatibilitySupported mainly for backwards compatibility
Hybrid Web PartsHybrid Web PartsWeb parts that inherit from Windows SharePoint Services Web parts that inherit from Windows SharePoint Services WebPart WebPart
Takes advantage of new ASP.NET base class featuresTakes advantage of new ASP.NET base class features
Imported via .webpart filesImported via .webpart files
Extensible Field TypesExtensible Field Types
Windows SharePoint Services V3 allows Windows SharePoint Services V3 allows developer to create custom fields typesdeveloper to create custom fields types
Create custom UI for easier data inputCreate custom UI for easier data input
Perform server-side data validationPerform server-side data validation
Use advanced rendering techniquesUse advanced rendering techniques
ExamplesExamplesSSN fieldSSN field
RatingsRatings
AddressAddress
Parts of a Custom Field TypeParts of a Custom Field Type
Base type it is inherited fromBase type it is inherited fromDefines the actual SQL storageDefines the actual SQL storage
Defines defaults (like rendering)Defines defaults (like rendering)
Query/Sort/Filter will be dependant on the base Query/Sort/Filter will be dependant on the base typetype
Field type XML definition (fldtypes.xml)Field type XML definition (fldtypes.xml)Defines field propertiesDefines field properties
Auto generates field UI to collect these propertiesAuto generates field UI to collect these properties
CAML rendering (optional)CAML rendering (optional)Views are still CAML basedViews are still CAML based
Field Customization UIField Customization UI
{Auto-generated field property input form based on field PropertySchema
SummarySummary
ASP.NET IntegrationASP.NET Integration
Page Templates vs. Page InstancesPage Templates vs. Page Instances
Master PagesMaster Pages
Web PartsWeb PartsNew ASP.NET Web Part ModelNew ASP.NET Web Part Model
Cross-site queryCross-site query
User controlsUser controls
Extensible Field TypesExtensible Field Types
The 2007 Microsoft Office The 2007 Microsoft Office System System Clients. Servers. Clients. Servers. Solutions.Solutions.
Install Beta 2 today! Install Beta 2 today! It’s in your attendee bagIt’s in your attendee bag
Learn more at the Office System TLCLearn more at the Office System TLCDemo Stations / Hands-on-Labs / Chalk-talksDemo Stations / Hands-on-Labs / Chalk-talks
Get more informationGet more informationhttp://www.microsoft.com/office/preview/default.mspxhttp://www.microsoft.com/office/preview/default.mspxhttp://http://msdn.microsoft.commsdn.microsoft.com/office//office/
TalkTalk
LabLab
DemoDemo
Fill out a session Fill out a session evaluation on evaluation on
CommNet andCommNet and Win an XBOX Win an XBOX
360!360!
© 2006 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.