Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005.

Similar presentations


Presentation on theme: "Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005."— Presentation transcript:

1 Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005

2 Web Parts Debugging, Deploying, And Best Practices Michael O’Donovan Consultant Microsoft UK

3 Agenda Web Part Basics Review Web Part Development and Debugging Developing Web Parts Advanced Web Part Topics Work Items and Timeouts IRuntimeFilter Caching ToolParts and ToolPanes Page Customization Deployment Packages and Installer

4 Web Parts Primary Platform Value of SharePoint End-user Customization of Pages In the Browser and in FrontPage Standard Extensibility Point Derive from Microsoft.Sharepoint.WebPartPages.WebPart Use Web Part Library Templates

5 Rendering Techniques Direct Render Using Strings HtmlTextWriter.Write(“…”) HtmlTextWriter.WriteBeginTag(“…”) Use ASP.NET HTML Primitives HtmlTableClass Delegating to ASP.NET Controls Componentize Your Rendering Logic

6 Basic Demo

7 Debugging Web Parts Methods Direct Attach to instance of W3WP.EXE “Automatic” Denote URL of a given Web Part Page as application start page

8 Debugging Web Parts (Continued) Deploying to the GAC makes debugging a little harder Must be able to reach PDB file Options Deploy to the bin directory while debugging Use manual installation Tracing System.Diagnostics.Trace HttpContext.Trace

9 Web.Config Settings Turn on debugging Change site’s Trust Level for the site Also “WSS_Medium” or “Full”

10 Debugging Web Parts

11 Development Topologies Windows Server 2003 WSSSPS Visual Studio.NET 2003 Windows XP Visual Studio.NET 2003 Windows Server 2003 WSSSPS Single Machine Development and Server All on One Box Development Machine Pushes to Server Shared Server

12 Single Machine Pros Simple Speedy Cons Licensing Time to setup Every dev an admin Hard to clean Windows Server 2003 WSSSPS Visual Studio.NET 2003

13 Shared Server Pros Dev box is simpler Cons Two machines Need scripts Notes Sharing a server is not recommended Virtual server per dev Copy Microsoft.SharePoint.* assemblies from C:\Program Files\Common Files\ Microsoft Shared \web server extensions\60\ISAPI Windows XP Visual Studio.NET 2003 Windows Server 2003 WSSSPS

14 Advanced Web Part Techniques

15 Work Items And Timeouts Built-in support for asynchronous work Allows other components to render Scenarios Data connections RSS Fetching Timeout renders based on web.config setting

16 WorkItems

17 IRuntimeFilter Allows you to filter which web parts run Allows you to persist metadata on parts Scoped to Virtual Server NOTE: Portal uses this for Audience Management

18 IRuntimeFilter

19 Caching Web Part Framework Per User or Web Part In Memory or Serialised into Database ASP.Net Cache Object Share Cache across Part Instances Enterprise Library Caching Application Block In HashTable Survives Application Restarts

20 Caching

21 Configuration How do I Store Central Configuration? Do Treat as.Net Server Control Don’t Use Web Part Resource File (XML)

22 Zone Customization Zone Properties AllowCustomization – Determines if the zone web parts can be modified AllowPersonalization – Determines if personalization is allowed FrameType – Determines the default frame type LockLayout – Determines if web parts can be added, resized, or removed

23 ToolParts And Customization ToolPart Controls WebPart specifies list of supported toolparts You derive from ToolPart Set properties on the parent web part Respond to Apply and Cancel Custom ToolPane? Rather hide ToolParts ICustomizeToolPane

24 Best Practices Handle All Exceptions Implement IDesignTimeHtmlProvider Interface Make Properties User Friendly Make Properties Searchable Check Web Part Zone Properties When Saving Changes

25 Best Practices Check Permissions when Rendering Validate Properties before Attempting a Save Specify Whether Your Web Part Can Be Exported HtmlEncode User Output Create Custom Web Part Base Class

26 Web Parts And Upgrade Changing Web Part Schema AfterDeserialize event Assembly Redirection in Web.Config

27 Distributing Web Parts

28 Manual Copy required files into location CAB files Two-step process with STSADM Stsadm –o addwppack –filename filename Stsadm –o addwppack –name filename MSI files Install directly on each server

29 Deploying Web Parts Method 1: Manual Copy assembly DLL to either /bin directory for a given IIS virtual server (e.g., c:\inetpub\wwwroot\bin) Global Assembly Cache (e.g., c:\windows\assembly) Copy DWP file to C:\Inetpub\wwwroot\wpcatalog Copy resources to For GAC-registered parts, C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources For Web Parts in the /bin directory, C:\Inetpub\wwwroot\wpresources

30 Deploying Web Parts Method 1: Manual Adjust web.config Register as SafeControl Select Code Access Security settings

31 Deploying Web Parts Method 2: CAB File CAB file should contain Assembly DLL DWP file(s) Manifest.XML Resource files (if needed) CAB won’t contain Code Access Security settings

32 Deploying Web Parts Method 2: CAB File Server-side object model has methods for deploying such a CAB file Deploy with STSADM.EXE Located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN Add it to your path Stsadm –o addwppack –filename filename [–globalinstall] [–force]

33 Deploying Web Parts Method 3: MSI File via WPPackager All of the features of CAB file deployment, but with Code Access Security support Ability to uninstall via Control Panel Get WPPackager.EXE from http://msdn.microsoft.com/sharepoint http://msdn.microsoft.com/sharepoint Add additional files to project for use by WPPackager Run WPPackager after project is built

34 Deploying Web Parts Method 4: Standard MSI File See the Site Definition Design and Deployment Talk later today for more details Challenges Per-virtual server settings and assemblies MSI Custom Actions Command Line Tools

35 Custom Online Web Part Gallery Easily Deploy.DWP Files Doesn’t Deploy the Assembly or Resources

36 Custom Online Gallery

37 Not The Only Way /_layouts/ Application DataView Web Part SmartPart IFrame PageViewer

38 What We Didn’t Cover HtmlDesignerAttribute CreateWebPartMenu Connections Web Part Services Component (WPSC)

39 Summary Debugging Options Advanced Techniques for Web Parts Best Practices Deployment Options

40 Discussion

41 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005."

Similar presentations


Ads by Google