SharePoint 2007 系列(5) -创建WebPart
Step1:创建一个Web Control Library Project
Step2: code
1 using System;
2 using System.Runtime.InteropServices;
3 using System.Web.UI;
4 using System.Web.UI.WebControls.WebParts;
5 using System.Xml.Serialization;
6
7 using Microsoft.SharePoint;
8 using Microsoft.SharePoint.WebControls;
9 using Microsoft.SharePoint.WebPartPages;
10
11 namespace VoVWebPart
12 {
13 [Guid("fcc142a4-6649-406f-9b6e-9cfa5c5278c6")]
14 public class VoWebPart : System.Web.UI.WebControls.WebParts.WebPart
15 {
16 public VoWebPart()
17 {
18 this.ExportMode = WebPartExportMode.All;
19 }
20
21 protected override void Render(HtmlTextWriter writer)
22 {
23 // TODO: add custom rendering code here.
24 // writer.Write("Output HTML");
25 writer.Write("Hello Sharepoint!!!");
26 }
27 }
28 }
29
2 using System.Runtime.InteropServices;
3 using System.Web.UI;
4 using System.Web.UI.WebControls.WebParts;
5 using System.Xml.Serialization;
6
7 using Microsoft.SharePoint;
8 using Microsoft.SharePoint.WebControls;
9 using Microsoft.SharePoint.WebPartPages;
10
11 namespace VoVWebPart
12 {
13 [Guid("fcc142a4-6649-406f-9b6e-9cfa5c5278c6")]
14 public class VoWebPart : System.Web.UI.WebControls.WebParts.WebPart
15 {
16 public VoWebPart()
17 {
18 this.ExportMode = WebPartExportMode.All;
19 }
20
21 protected override void Render(HtmlTextWriter writer)
22 {
23 // TODO: add custom rendering code here.
24 // writer.Write("Output HTML");
25 writer.Write("Hello Sharepoint!!!");
26 }
27 }
28 }
29
Walkthrough: Creating a Basic SharePoint Web Part
http://msdn.microsoft.com/en-us/library/ms452873.aspx
Developing and Deploying Custom Web Parts for SharePoint Portal 2007

浙公网安备 33010602011771号