Download presentation
Presentation is loading. Please wait.
Published byMary Burns Modified over 9 years ago
1
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview VITALE, CATURANO & COMPANY LTD SharePoint Developer Series – Web Part Development.: Michael Williams :. May 12, 2005
2
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 2 I.Web Part Essentials II.Microsoft FrontPage Customization III.Web Part Development IV.Resources V.Questions Session Agenda
3
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 3 Building blocks for modular web pages Provides connection to information + apps Built by developers ASP.NET Server Controls Added to pages by site owners Easy configuration Personalized by end users Rich and custom client experience Web Part Essentials
4
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 4 Web Part Essentials – Developer Perspective ASP.NET Server Control based Web Part is a ASP.NET server control Full power of Visual Studio as a premier development environment Project templates on MSDN Intelli-sense, debugging, source control, etc. Deployed as an assembly Reusable across thousands of pages and sites Admins control which Web Parts are available End users decide where Web Parts are used
5
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 5 Web Part Essentials - ExamplesAnnouncementsMembers Events Contacts Links
6
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 6 Web Part Essentials – Tool Parts
7
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 7 SharePoint Web Page Zones are embedded directly on the page <SmartPages:WebPartZone runat="server" Title=“Left ZoneID=“…" Orientation="Vertical“ AllowCustomization=“true” AllowPersonalization=“true”/> Web Part Essentials – Zones Database All users and just for me web parts inside zones are stored in the SharePoint WebParts table Personalizations stored in the SharePoint Personalization table
8
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 8 Web Parts are equivalent to ASP.NET Web Form Controls SmartPage - controls on page determined by database URL of the page ID of the current user (personalization) SmartPages work in safe mode only Web Part Essentials – Working Together ASP.NET Page Zone 2 Zone 1 Zone 3 Web Part Framework Content DB ASP.NET Page Web Form Controls
9
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 9 Microsoft FrontPage Customization
10
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 10 Web Part Development -.Net Framework Custom ASP.Net Web Control derived from System.Web.UI.Control Base class handles – Page rendering Property settings Post-back events State management
11
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 11 Web Part Development -.Net Template Download WebPartTemplatesforVSNetSample.EXE Download WebPartTemplatesforVSNetSample2.EXE Templates help creation of Web Parts Similar to default server control file and project templates of VS.NET
12
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 12 Web Part Development – Create New Web Part Library Project
13
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 13 Web Part Development – The.DWP File Description Web Part
14
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 14 Web Part Development – Web Part Namespace & Class Name Namespace is MyWebPart1 Class name is WebPart1 namespace MyWebPart1 { /// /// Summary description for WebPart1. /// [DefaultProperty("Text"),ToolboxData(" "),XmlRoot(Namespace="MyWebPart1")] public class WebPart1 : Microsoft.SharePoint.WebPartPages.WebPart { // more code here
15
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 15 Web Part Development – Assembly Properties Assembly name is MyWebPart1 Namespace is MyWebPart1
16
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 16 Web Part Development – Remote Server Output Path If developing against remote machine Set the output path to the remote location's bin directory
17
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 17 Web Part Development – “Hello World!” Code /// /// Render this Web Part to the output /// parameter specified. /// /// The HTML writer to /// write out to protected override void RenderWebPart(HtmlTextWriter output) { output.Write(SPEncode.HtmlEncode(Text)); //Create a label Label myLabel = new Label(); //Write the text myLabel.Text = "Hello World"; //Add the label control to the page this.Controls.Add(myLabel); //Render the HTML output myLabel.RenderControl(output); }
18
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 18 Web Part Development – Code Access Security CAS allows box administrators grant specific rights to assemblies Goal is to separate user access rights from the assembly access rights Administrators can Deny access to local resources for partial trusted assemblies Allocate trust based on signatures, strong names, and certificates
19
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 19 Web Part Development – Code Access Security Provides a safe execution environment for SharePoint & Web Part Pages Only registered assemblies are executed. NO SERVER-SIDE SCRIPT CODE ON SAFE MODE PAGES. CAS eliminates the following risks - User-inserted code Infinite loop Memory consumer Unapproved user-inserted references to Web Form Controls & classes How to use Safe Mode Install web part assembly in either – Virtual server’s bin directory Global Assembly Cache (GAC) On each virtual server – Enable the assembly in the SafeControls list in the web.config file Administrator optionally enables specific types within the assembly Control will not instantiate during the rendering of the.aspx page if class is marked unsafe or unlisted
20
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 20 Web Part Development – Strong Naming Assemblies Create Key-pair File c:\Program Files\Microsoft Visual Studio.NET 2003\SDK\v1.1\Bin\SN.exe SN –k c:\keypair.snk Modify Assembly Web Part’s AssemblyInfo.cs Modify [assembly: AssemblyKeyFile(“path\filename”)]
21
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 21 Web Part Development – Web Part Deployment Assembly located in - GAC bin (sub directory under the application root) Windows SharePoint Services Controls, Namespaces and Assemblies have to be marked as ‘safe’ in web.config Class Resources and.dwp’s deployed to specific locations Resources are deployed relative to assembly location File System locations – %AppRoot%\wpcatalog\%AssemblyName% %AppRoot%\wpresources\%AssemblyName% C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\wpresources\%AssemblyName% URL - http:// /_wpresources/
22
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 22 Web Part Development – Web Part Package Package contains: Manifest.xml Web Part Assemblies Class Resources .DWP’s Package is a cabinet file (.cab) Create a.cab file using MakeCab.exe Command-line based Available with Windows.Net Server 2003 Creates web part packages with localized resources Web Part Packages are deployed using the stsadm.exe tool 3 operations related to Web Part Packages - AddWPPack EnumWPPacks DeleteWPPack
23
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 23 Web Part Development – Web Part Package Manifest
24
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 24 Web Part Development – Add “Hello World” Web Part
25
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 25 Web Part Development – Debugging Web Parts Local machine Set in web.config of the virtual server Enable ASP.Net debugging Attach to the w3wp.exe process Remote machine Similar setup steps as debugging a project on a local machine Require permissions to debug on the remote machine (integrated security) Attach to the remote w3wp.exe process Set start page in Visual Studio.NET that includes the Web Part
26
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 26 Web Part Development – Rendering Overview ASPX Page Web Part WebPart.Render()CustomPart.RenderWebPart() ASP.NET starts page render Request
27
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 27 Resources Microsoft SharePoint http://www.microsoft.com/sharepoint http://www.microsoft.com/sharepoint Microsoft SharePoint Server Customization http://www.sharepointcustomization.com/resources/webcasts.htm http://www.sharepointcustomization.com/resources/webcasts.htm Microsoft Developer Introduction to Web Parts http://msdn.microsoft.com/library/default.asp?url=/library/en- us/odc_SP2003_ta/html/sharepoint_northwindwebparts.asp Microsoft SQL Server http://microsoft.com/sql/default.asp http://microsoft.com/sql/default.asp
28
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 28 Questions?
29
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview 29 VITALE, CATURANO & COMPANY PC
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.