Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Developing and Deploying Custom Web2007

Developing and Deploying Custom Web2007

Ratings: (0)|Views: 1|Likes:
Published by Abhi

More info:

Published by: Abhi on Mar 12, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Developing and Deploying Custom Web Parts for SharePoint Portal 2007
Overview and difference with SPS 2003:
Developing Web Part for SharePoint Portal 2007 is different as compared todeveloping for SPS 2003. Web Parts Developed in .Net 1.1 for SPS 2003 used the
namespace, however the Web Part in ASP.Net 2.0 isfound under the
Development of Web Part in VS 2005
To Get Started with creating Custom Web Part for MOSS 2007 in Microsoft VisualStudio 2005, Open the IDE and create a new C# project, Select Class Library asProject Type. Name It as
Add a reference to the System.Web from .Net components into the project. The System.Web dll contains the required namespace of 
. In The Project explorer view rename the Class1.cs with NewWbPart.cs to be consistent with this example; this will result in renaming theClass name as well. With the help of “using” keyword include the namespaces as shown in the code example below. Derive / Extend theNewWebPart Class from the WebPart Class ( System.Web.UI.WebControls.WebParts.WebPart), and add the code as shown below. TheCreateChildren Control is same as in .Net 1.1, that it would create and add controls to this Web Part Class,. In this case I have onlyadded a WebControl.Calender Object. The RenderControl Method is an override for the WebPart Base Class and calls the RenderChildrenMethod, this causes the Children Controls to be rendered on the Particular HtmlTextWriter passed as a parameter to the method.using System;using System.Collections.Generic;using System.Text; using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts; 
namespace NewWepPart{public class NewWebPart : WebPart{ protected override void CreateChildControls(){Calendar cldr = new Calendar();cldr.Enabled = true;cldr.ShowGridLines = true;cldr.ShowTitle = true;cldr.EnableViewState = true;cldr.SelectedDate = DateTime.Now; Controls.Add(cldr);
} public override void RenderControl(HtmlTextWriter writer){ RenderChildren(writer);} }} Build the project and on successful built you are ready to Deploy the Web Part to the Portal Site.
Deployment of Web Part:
In order to deploy a web part to a SharePoint portal 2007 site, we must have the URL of the site to which we want our web part needs tobe deployed (displayed in fact). As it is mentioned earlier that the Web Parts developed in .Net 2.0 environment does have a .CABproject , instead an assembly is created on build of project. Now there are two choices to deploye the assembly to the SharePoint portaldirectory.
Deploy the assembly to the Assembly Folder (GAC) (requires the assembly to be stron named).
Put the assembly to the bin folder of the portal directory.For the sake of simplicity, the later choice is being demonstrated in this example.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->