Sunday 8 June 2014

SharePoint Web Part Development

Client and Servers are different.
Steps:
1.In the client create a new class, write your code related to Webpart.(If you have webpart extentions in your Visual Studio, you can create new webpart project)
If you have sharepoint extentions then,
Open Visual Studion--> File-->New-->Project-->Visual C#-->Sharepoint-->Web part-->Create.
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace WebPart1
{
[Guid("c5f8b2b9-71b6-4810-93dc-cb3015d545e4")]
public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
{
public WebPart1()
{
}
protected override void CreateChildControls()
{
base.CreateChildControls();
// You Can add custom rendering code here.
Label label = new Label();
label.Text = "Hello World";
this.Controls.Add(label);
}
}
}
2.Add sn Key.
3.generate DLL.
4.Go to Server.Copy Dll form client to server.
5.Add Dll to GAC in server.
6.GO to below path in server.
C:\Inetpub\wwwroot\wss\VirtualDirectories\[Port]\bin
EX: [port]- 8888 or 80 or 8080
7.paste (Place) your DLL in the abpve path.
8.go to below path.
C:\Inetpub\wwwroot\wss\VirtualDirectories\[port]
9.Open web.config file.
10.Find below code
11.Copy above code and paste it again.
12.In the newly pasted code change Assembly,Version,PublicKeyToken,Namespace with your DLL. Save the config file.
13.go to run
14.execute iisreset
15.go to http://[SERVER]:[Port]/default.aspx
16.go to Site Actions-->Site Settings-->Click Web parts (Under Gallerie)
17.Click New
18.You can find your new web part in this page.Check the checkbox and click on "Populate Gallery"
19.Go to Home page.
20.Site Actions-->Edit Page.
21.Click on Add a web part.
22.One new window will open.
23.Under Miscellaneous-->find your webpart.
24.Click Add.
25.Exit Edit Mode.
Client and Servers are Same
1.In the client create a new class, write your code related to Webpart.(If you have webpart extentions in your Visual Studio, you can create new webpart project)
2.Add sn Key.
3.generate DLL.
4.Copy DLL from current Bin.
Pls ref above steps form step 5.