Tuesday, September 25, 2007

Create a WebPart in MOSS 2007

Build the Web Part derived from ASP.NET 2.0 Detail reason from Andrew Connell: "The official recommendation is to use the ASP.NET 2.0 WebPart class in System.Web.UI.WebControls.WebParts. Don't use the SharePoint WebPart class unless you have a specific reason (which is usually for backwards compatibility)."

I tried the instructions from Developing and Deploying Custom Web Parts for SharePoint Portal 2007. But it never worked to show the web part up on the new web parts page. Then it took me a long time to figure it out why. It's because of the assembly name "NewWebPart". I don't know why this name caused the problem. But after I changed it to "CusCalendar" with the namespace "CusLib", it's showing up in the new web parts list.

Two articles on the MSDN site are very helpful:
Walkthrough: Creating a Basic Web Part
and
Walkthrough: Creating a Basic SharePoint Web Part

Now I get through with trust level WSS_Medium. Next, I will try creating a new trust policy file.

No comments: