Greetings everyone, from Visual Studio 2005 extensions for Windows SharePoint Services 3.0 development team.
In the previous issue, we introduced the necessary steps to prepare the SharePoint development environment with VSeWSS. From this issue, we will be finally talking about actual SharePoint development with VSeWSS. Today we will try preparing a classic "Hello World" Web Part. It is very simple and just displays "Hello World!!" on the top of a Web Part. Let's get started.
1. Creating the projectStart up Visual Studio, and create a Web Part project from the project creation wizard.The Web Part project template can be found by selecting the SharePoint project type, which is a subtype of a Visual C# project. We will name the Web Part project"Hello World" this time.
After the project is created, the necessary files for developing the SharePoint Web Part will be loaded. You can get started on development work very easily without any hassle since VSeWSS will prepare all the necessary files for you.
2. Implementing the print methodIn order to change what's printed on the Web Part, the Render method of the WebPart class needs to be modified. Open the WebPart1.cs file from the Solution Explorer, and modify the Render method in the Hello_World class as follows:
3. Verifying your codeNext, build and run the code you implemented in Step2. Here we run the code in debug mode, by simply hitting F5. Once the debug operation starts, VSeWSS will build the necessary source files and register the Web Part onto the target SharePoint server. Afterwards, Internet Explorer will start up, and you will be able to browse the Web Part Gallery.
As you can see from the screenshot above, you can verify the operation of the Web Part you implemented within the Web Part Preview page of Web Part Gallery.
You're now done with the implementation of your "Hello World" Web Part. How did you like it?We hope you get the feeling that VSeWSS can simplify your development process. VSeWSS is a very useful tool which prepares necessary files in order for you to develop a SharePoint Web Part. It also automatically registers your Web Part onto the target SharePoint server which allows you to verify the actual Web Part’s operation.
Our next topic will be on VSeWSS's useful features to assist you with Web Parts development.
Read the Japanese version of this article | 日本語版はこちら
Any opinions expressed in this blog are solely those of the author and not official positions of Microsoft Corporation.