Agusto Xaverius P Sipahutar

Job:Making some bugs and patch
Moss/Wss,C#,Sql Server,WWF,K2.BlackPearl
Motto : Keep Study and study
See also: Other Geeks@INDC

News




MCP Logo
MCTS Logo

MCP ID# 3542391

My Curiculum Vitae


Agusto Xaverius P S's Facebook profile

Other Article

My Community

My Article/Share Knowledge

Others Moss/Wss Site

My Other Website/Blogs

My Share (Ebook,etc)

May 2010 - Posts

Simple WebPart On SharePoint 2010 Using Visual Studio 2010

Sekarang developer SharePoint semakin di manjakan dengan fully support-nya Visual Studio 2010 telah mendukung environment SharePoint 2010. Hal ini membuat menjadi lebih mudah membuat aplikasi (Webpart, Event handler, Business Data Services, dll), debugging, dan deployment.

Di bawah ini saya akan berikan step-step bagaimana membuat webpart dengan visual studio 2010 dan langsung akan terdeploy kedalam Sharepoint 2010 kita :

1. Tampilan depan SharePoint 2010

image

2. Create Sharepoint Project dengan Visual Studio 2010

 image

3. Setting URL ShaePoint yang dipakai untuk deployment dan pilih “Deploy as a Farm Solution”

image

Perbedaan antara Deploy as a Sandboxed Solution bisa di lihat pada link ini : http://social.msdn.microsoft.com/Search/en-US?query=Sandboxed%20or%20Farm%20solution&ac=8 atau http://msdn.microsoft.com/en-us/library/ee361616.aspx

4. Pada Visual Studio 2010 Project SharePoint kita, akan otomatis Microsoft.SharePoint masuk didalam reference assembly yang kita butuhkan

image

 

 

5. Create a new Item Web Part File dengan nama TestWebPart

image

6. Input dengan code sebagai berikut :

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
 
namespace SharePointProject1.TestWebPart
{
    [ToolboxItemAttribute(false)]
    public class TestWebPart : WebPart
    {
        private Label lbl; 
        protected override void CreateChildControls()
        {
            lbl = new Label() { Text = "Hello ini adalah Test Web Saya yang pertama di SharePoint 2010" };
            this.Controls.Add(lbl); 
        }
 
        protected override void Render(HtmlTextWriter writer)
        {
            
            base.Render(writer);
        }
    }
}

 

7. Edit Property Web Part untuk Update Title dan Description

 image

8. Build Solution dan Setelah itu Deploy Solution

9. Tambahkan WebPart yang telah terdeploy tersebut ke SharePoint Site yang telah di pilih sebagai deployment pilihan kita tadi.

image

10. Hasilnya seperti ini :

image

Selamat Mencoba.

Share this post: | | | |