Wednesday, May 28, 2008

The first Application Template for Windows SharePoint Services 3.0 now available

Resolution related to ApplicationTemplateCore.wsp command line error:
Finally what helped to us is as following:
1)Download the solution .EXE file to your computer.
2)Run the .EXE file to unpack the template file
to a location on your computer.
Copy ApplicationTemplateCore.wsp file in to
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN location
3)Click on Start
4)Click on Run
5)Type Cmd
6)Type CD C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
7)Type(Don't paste, that would not work)following command
STSADM.EXE -o addsolution -filename ApplicationTemplateCore.wsp


SharePoint End User Security

Very Nice article on Authentication.

Tuesday, May 27, 2008

Adding user control to SharePoint 2007 (MOSS/WSS) Web Part

1. Open Visul Studio 2008/2005, Add New Project> Select Empty Template name "Test.Development"

2. Add a Webpart by selcting the Webpart template Name "TestUCWebpart "

a. Create a object of User Control

UserControl _control;

b. Add following code in public class

this.ExportMode = WebPartExportMode.All;

c. Add following code in Create child control
_control = (UserControl)Page.LoadControl(@"~/_controltemplates/Mycompany/UC.ascx");

d. Add following code in Render

Following is the code
*****************************WebPart code***************************************

using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace Test.Development{

public class TestUCWebpart : System.Web.UI.WebControls.WebParts.WebPart

UserControl _control;

public TestUCWebpart()
this.ExportMode = WebPartExportMode.All;

protected override void CreateChildControls() {
_control = (UserControl)Page.LoadControl(@"~/_controltemplates/Mycompany/UC.ascx"); Controls.Add(_control);

protected override void RenderContents(HtmlTextWriter writer)

******************************End of Webpart code**************************************

3. Add New project as ASP.NET Webapplication Name "UCWebApplication"

a. Add One Web control (.ascx) "UC.ascx"

b. Write Code desing and code

c. Add following on the top in .ascx file

//Webpart Assembly name
//Modify ascx

4. Assign Strong Key

5. Build

Following is the code




**************end of ascx*******************


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace UCWebApplication
public partial class UCNew : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
protected void btnSubmit_Click(object sender, EventArgs e)
string szState = ddlState.SelectedValue;
lblResults.Text= "Hello" + txtFirstName.Text + txtLastName.Text + txtCity.Text + szState ;


protected void btnReset_Click(object sender, EventArgs e)
lblResults.Text= "Hello" ;
txtCity.Text = "";
txtFirstName.Text = "";
txtLastName.Text = "";
ddlState.SelectedIndex = 0;

*************end of .cs*******************

6. Copy AScx and ascx.cs in to controltemplates//

7. copy .dll of control webapplication to C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin

8. Go to C:\Inetpub\wwwroot\wss\VirtualDirectories\80 and edit Web.config

9. Add both the assemblies in to safecontrol list

10. Add both the assemblies in asseiblies list

11. Make Trust

12. Webpart is ready now