Create a webpart using visualstudio 2010. For that do the follwing:
1.InVisualStudio 2010 Open File->Project.
2.Select SharePoint Template and select VisualWebPart.
3.Specify Your SharePoint Site where you wanted to create webpart and click Finish.

4.On Your Project place a listbox and a button and on Button Click event write the following code.
list1.Items.Clear();
SPWeb web = SPControl.GetContextWeb(Context);
foreach (SPUser usr in web.AllUsers)
{
list1.Items.Add(usr.Name);
}
NB : include namespace Microsoft.SharePoint; Microsoft.SharePoint.WebControls for getting SPWeb and SPControl;
5.Build and Deploy Solution.
6.The Webpart that created will displayed on Custom Category.Add the WebPart .

7.On Button Click the webpart will dispalay the Visited Users name

1.InVisualStudio 2010 Open File->Project.
2.Select SharePoint Template and select VisualWebPart.
3.Specify Your SharePoint Site where you wanted to create webpart and click Finish.
4.On Your Project place a listbox and a button and on Button Click event write the following code.
list1.Items.Clear();
SPWeb web = SPControl.GetContextWeb(Context);
foreach (SPUser usr in web.AllUsers)
{
list1.Items.Add(usr.Name);
}
NB : include namespace Microsoft.SharePoint; Microsoft.SharePoint.WebControls for getting SPWeb and SPControl;
5.Build and Deploy Solution.
6.The Webpart that created will displayed on Custom Category.Add the WebPart .
7.On Button Click the webpart will dispalay the Visited Users name
No comments:
Post a Comment