Friday, August 8, 2008

Moss 2007 Custom webparts (Part I-Environment Setup.)

The first thing any Moss2007 developer think about is how to create custom webpart and see how it will enhance his website functionality even if this start is the most famous Microsoft starting application "Hello World".


But here i'll go directly to the point which is "Start with environment setup, some concepts, developing simple webpart does something useful and walk through some enhancements to get robust one".


So with this series whatever your proficiency level you will find your start-point for doing this stuff.


Sorry for long intro. But i see it is nice to explain the strategy i'll follow at any issue i'll blog.


let's have some fun.....


Tools i use:
  • VS.NET 2008.
  • SharePoint Object Model(APIs-Application programming interface- for programmers).
  1. Open VS.NET 2008, from menu File --> New -->Projects.
  2. From left pane"Project types" select Visual C#--> Windows.
  3. At right pane"Templates" select Class Library.
  4. At text boxes down type your project "webpart" name "FirstWebPart".


  5. Let Visual Studio create the necessary project components for you.
  6. From Solution Explorer rename Class1.cs to FirstWebPart.cs.
  7. NOTE: At code editor, text after namespace and class are changed automatically(save seconds to rename it manually-thanks Microsoft).



  8. It's time to add some "DLLs" to help us to do our job.
  9. From Solution Explorer, right click on References --> Add Reference.

  10. Dialog Add Reference will appear and from .NET tab select tow references(System.Security - System.Web).

  11. To finish this step we missed only one important reference..Guess what? YES, it's SharePoint reference

  12. To get SharePoint DLL to be referenced at your project it depends on where you develop your webpart now, is it on machine with MOSS 2007 installed? or your own winXP machine(sharepoint not installed locally).

  13. CASE 1 "Machine with MOSS 2007 installed": Dialog Add Reference go to Browse tab and go to this URL(assuming your moss installed on c: drive)
    C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI

  14. CASE 2 "Local winXP machine": Ask your system administrator to locate this DLL on MOSS 2007 server and send it for you from mentioned ISAPI hive and save it at your local machine and locate it using previous step.

  15. At Solution Explorer the References node will look like the image below.
  16. Add directives to get access to different class inside references added earlier as Step1 shown in image below.
  17. Let your class inherits from WebPart class "That's why we add SharePoint reference-POINTS 12, 13 and 14"as Step2 shown in image below..

  18. After all these steps we have readymade environment for our development.

Now we have space to start our development.

Wait me next article and it will be soon...

1 comment:

daspeac said...

I have heard about another way of data recover from crrrupt mdf file. Besides, you can visit my blogs at: http://daspeac.livejournal.com/ or http://daspeac.blogspot.com/ where I’m trying to share my experience with regard to data corruption issues.