SharePoint for Developers Lunch and Learn
2 Agenda Overview Architecture Web Parts Workflow Events Deployment Other Development Topics
3 WSS v3 vs MOSS WSS v3 Windows SharePoint Services Free with Windows Server 2003 MOSS 2007 Microsoft Office SharePoint Server Extends WSS v3 Standard and Enterprise licenses
No code App Dev vs Custom App Dev No code Simplified deployment Simplified maintenance Limited capability Custom App Dev Greater capability Longer development cycle More involved testing and deployment
5 No code App Dev Lists and Libraries Content Types Layout Pages Standard web parts Content Editor Web Part Content Query Web Part Data Form Web Part SharePoint Designer Workflows Content database changes only
6 Custom App Dev Custom Web Parts Custom Visual Studio Workflows Web part pages with code behind Event Receivers User Controls Site Definitions Custom Provisioning Providers Components deployed to the file system of the SharePoint server(s)
7 Agenda Overview Architecture Web Parts Workflow Events Deployment Other Development Topics
Logical Components Central Administration SharePoint Config database Shared Service Provider Web Application IIS Web Site Site Collections Content Database Sites and Sub-Sites Index Server
9 Architectural Benefits SQL Server IIS Windows Workflow ASP.NET 2.0 Authentication (e.g., forms based) Master Pages Navigation Providers Http Handlers / Modules Web Parts
10 Architectural Result WSS v3 can be a development platform
11 Agenda Overview Architecture Web Parts Workflow Events Deployment Other Development Topics
12 Web Parts What are Web Parts? Web Part Object Model Web Part Pages / Zones / Manager Web Part Lifecycle Web Part Properties Editor Parts Verbs Web Part Connections Debugging Web Parts Deploying Web Parts Other Considerations
13 What are Web Parts? Vital way to customize and extend SharePoint Create user interface elements Web Parts support Customization - changes made to the web part can be seen by all site members Personalization changes will only be seen by the user that made the changes Easy and powerful way to extend SharePoint
Example Web Parts 14
15 Web Part Object Model System.Object System.Web.UI.Control System.Web.UI.WebControls.WebControl System.Web.UI.WebControls.Panel System.Web.UI.WebControls.WebParts.Part System.Web.UI.WebControls. WebPart System.Web.UI.WebControls. EditorPart MyWebPart MyEditorPart
16 Web Part Pages Web Part Page Hosts Zones and Web Parts Has access to all ASP.NET services Web Part Zone Hosts Web Parts Determines layout of Web Parts Web Part Derived from ASP.NET 2.0 Web Part Provides framework for UI Created like custom server controls
17 Web Part Pages Web Part Page Web Zone Web Part Web Zone Web Zone Web Part Web Part Web Part
18 Web Part Manager SharePoint has SPWebPartManager which extends the ASP.Net WebPartManager Stores web part instances and properties in content database Manages lifetime of Web Part instances at run time Just like ASP.NET each page must contain Exactly one WebPartManager One or more WebPartZone objects SharePoint provides SPWebPartManager on default.master
19 Web Part Lifecycle OnInit OnLoad CreateChildControls OnPreRender Render RenderContents
20 Web Part Properties using System.ComponentModel; [Personalizable(PersonalizationScope.Shared), WebBrowsable(true), WebDisplayName("Property 1"), WebDescription("Description for Property 1"), Category("My Properties")] public string Prop1 { } get { return _prop1; } set { _prop1 = value; }
21 Editor Parts MyWebPart.CreateEditorParts() public override EditorPartCollection CreateEditorParts() { List<EditorPart> editorparts = new List<EditorPart>(1); EditorPart part = new MyEditorPart(); part.id = this.id + "_confluencepageeditorpart"; editorparts.add(part); } return new EditorPartCollection(base.CreateEditorParts(), editorparts); MyEditorPart.SyncChanges() public override void SyncChanges() { this.ensurechildcontrols(); MyWebPart mywebpart = this.webparttoedit as MyWebPart; MyEditorPart.ApplyChanges() public override bool ApplyChanges() { this.ensurechildcontrols(); MyWebPart mywebpart = this.webparttoedit as MyWebPart; } if (mywebpart!= null) { _prop1 = mywebpart.prop1; _prop2 = mywebpart.prop2; } } if (mywebpart!= null) { mywebpart.prop1 = _prop1; mywebpart.prop2 = _prop2; } return true;
22 Verbs MyWebPart.Verbs public override WebPartVerbCollection Verbs { get { string verbscript = String.Format( "window.open('{0}/pages/editpage.action?pageid={1}', MyPage')", _url, _pageid); List<WebPartVerb> verbs = new List<WebPartVerb>(); WebPartVerb myverb = new WebPartVerb(this.ID + "_myverb", verbscript); myverb.description = "Edit the Confluence wiki page."; myverb.text = "Edit Confluence Page"; myverb.imageurl = Constants.WebPartTitleIconImageUrl; verbs.add(myverb); WebPartVerbCollection allverbs = new WebPartVerbCollection(base.Verbs, verbs); } } return allverbs;
23 Web Part Connections Link between server controls shares data Always involves exactly two controls Provider Consumer Control can be both provider and consumer A provider can have connections with multiple consumers at the same time Consumer can only connect with one provider
24 Web Part Connections Custom Connections Custom interface ConnectionProvider attribute ConnectionConsumer attribute Generic Connections IWebPartField IWebPartRow IWebPartTable
25 Debugging Web Parts Debugging Web Parts is similar to debugging ASP.NET 2.0 Web Controls Modify web.config Set <compilation debug= true > Allow errors, <customerrors mode="off"/> Enable ASP.NET debugging Attach to the w3wp.exe process
26 Deploying Web Parts Must deploy ASP.NET Web Part into a WSS site Export/Import your ASP.NET 2.0 file into a.webpart file Strongly name your assembly (if deploying to GAC) Copy your assembly to the \bin folder or the GAC Register web part as a Safe Control OR Use a tool such as VSeWSS
27 Other Considerations Existing Web Parts List View Web Part WSS Web Parts MOSS Web Parts Using User Controls VS Project Type: Web Application Smart Part 3 rd Party Controls GAC Deployment vs. Bin w/cas
Web Part Demo
29 Agenda Overview Architecture Web Parts Workflow Events Deployment Other Development Topics
30 Windows Workflow Reactive / Episodic / Resumable Activities Base Activity Library (BAL) WSS Activity Library Composite Activities Sequential vs. State Machine
31 SharePoint Workflows Associations Primary List Workflow History List Task List Workflow Input Forms List Association Initiation Modification Task Edit
32 Workflow Tools SharePoint Designer Visual Studio InfoPath Third Party Workflow Engines/Tools Nintex K2 Skelta
33 Agenda Overview Architecture Web Parts Workflow Events Deployment Other Development Topics
34 SharePoint Events Synchronous vs. Asynchronous Events SPItemEventReceiver Add, Update, Delete AttachmentAdd, AttachmentDelete Checkin, Checkout, UnCheckout FileMove SPListEventReceiver FieldAdd, FieldDelete, FieldUpdate SPWebEventReceiver SiteDelete, WebDelete WebMove (There is not SiteAdd use provisioning provider) SPFeatureReceiver Activated, Deactivating, Installed, Uninstalling
35 Agenda Overview Architecture Web Parts Workflow Events Deployment Other Development Topics
36 Deployment Features Scope: Farm, Web Application, Site, Web Can be activated / deactivated Solutions Manage deployment of features Bundled into.wsp file (cab file) Can change web.config and files on each WFE Can do this to WFE s added after a solution is deployed
37 Deployment Tool Progression STSDEV VSeWSS v1.3 VSeWSS v1.2 WSP Builder Batch Scripts
38 Other Deployment Tools SharePoint Solution Generator PowerShell Scripts SharePoint Solution Installer
Deployment Demo
40 Agenda Overview Architecture Web Parts Workflow Events Deployment Other Development Topics
41 Other Development Topics Application Pages Do not support user customization To customize extend LayoutsPageBase Site Pages Support user customization Custom Fields Branding WSS v3 and MOSS are big It takes a while to know what you don t know
42 MOSS Concepts BDC Excel Services Forms Services Records Center Publishing Sites Search My Sites
43 Wrap Up Links: ThreeWill technical blog: http://implementingsharepoint.com ThreeWill Wiki: http://sharepointdepth.com Learning SharePoint: http://wiki.threewill.com/display/enterprise/learning +SharePoint http://www.microsoft.com/click/sharepointdeveloper/ Recommended Book: Inside Microsoft Windows SharePoint Services 3.0 by Ted Pattison and Daniel Larson Questions?