Skip to main content

Developing WebParts for SharePoint

Here are the tips I wish I had known before this week and this is what I learned so that you won't have to go throught the same pain when learning to build Webparts in SharePoint.

-Ted Pattison has the best screencasts on SharePoint that I have found. He is also very funny. I insist that you watch the "Building ASP.NET Web Parts for Windows SharePoint Services 3.0" as your first step to learning how to build a SharePoint webpart! Setup your environment as detailed below, and then walk through Ted's demo with him. IMPORTANT TIP. Make sure you DOWNLOAD the screencast (right click and save target as) so that you can pause and rewind the video as he walks through it. This video is the key to the difference between frustration and success!

-Download The latest SDK for Sharepoint WSS 3.0. Open up the help file WSS3sdk.chm, and start with the "Walkthrough: Creating a Basic SharePoint Web Part" (After you've gone through Ted Pattison's Screencast). The corresponding article online at MSDN appears to have lots of errors, so I recomment opening the one in the WSS3sdk.chm.

-For debugging webparts, make sure you have customerrors=off in your web.config file. The key to debugging webparts is having Visual studio installed on the same machine as Sharepoint, so that you can set breakpoints and actively debug your code. Copying the Sharepoint DLLs isn't enough, that will at least let you compile and use intellisense, but to debug, VS and Sharepoint have to be on the same box. You may need to set up a virtual machine since you probabaly don't have sharepoint set up on your laptop and you don't have a spare $2,000 to buy a physical server.
+another tip from Ted Pattison: set your Visual Studio project so that the output builds to the bin directory of your sharepoint website. for example:
C:\Inetpub\wwwroot\wss\VirtualDirectories\50000\bin
However, if you are building a webpart that needs elevated trust, you have to deploy it to the GAC. Here is a nifty trick to automatically deploy to the gac using a post-build script (project properties withing Visual Studio)
C:\WINDOWS\system32\dllcache\gacutil.exe /i I:\VSSworking\I.root\timelineXmlWebpart\bin\Debug\timelineXmlWebpart.dll

Comments

Popular posts from this blog

How to Create and Run Tableau Bridge on Linux Containers

Tableau Bridge is now availble on Linux Containers. Yay! Now what does this mean and how do I build and run Linux Containers? We will discuss the advantages of running Bridge on Linux Containers the steps to build them, and finally, we will provide some automation script ideas for monitoring and scaling Linux Bridge agents. Tableau Bridge Today Until recently, Tableau Bridge was only available as a Windows application running on a Windows VM. It supported only one bridge agent per Virtual or Physical Machine. Advantages of Bridge in Containers Better Hardware Utilization: Linux containers are more efficient than Windows VMs, requiring only about 1/50th of the disk space. Ability to Spin Up Multiple Bridge Agents: With Linux Containers, it becomes easier to spin up multiple bridge agents on a single machine, improving scalability and resource utilization. Infrastructure Automation: Linux Containers enable easier automation of provisioning bridge agents and upgrading Tableau Bridge, the...

RAM Disks do not speed up Visual Studio

  The limiting factor for Visual Studio is disk IO. I got a tip to speed up Visual Studio from Channel 9 by creating a RAM disk which sounded like a great idea. However, when I ran a thorough set of tests, I found that the performance difference between the Ram disk and the hard disk were not appreciably different. This was a big surprise since RAM is 240,000 times faster than disk (see my previous blog post). But the reason is because Visual Studio and Vista do a lot of caching. So compile times for the same project in RAM disk and on hard disk were pretty similar. I also tested the time it took to search the entire solution for a word, and times to open a solution. There was no discernable difference!   If you still want to try it out and create your own RAM disk, you can download a simple RAMDISK.EXE utility to create a RAM disk in just a few minutes. What is a RAM Disk ?   Ramdisk is a virtual drive created in RAM.   Performance Analysis Creating f...

Outlook tip: Turn off Email Contact Pictures

  Many people find the photos in the window border to be a little distracting. It is easy to turn them off by adding a registry key.  Follow these simple steps: 1) Save the text below between the lines into a text file and rename the file “dontShowContactPicture.reg”. ------ Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Options\Mail] "ShowContactPicture"=dword:00000000 ------ 2) Double click the file and you will be prompted: 3) Restart Outlook. 4) See the result: Before: After: 5) To undo this change and turn pictures back on, simply edit the file and change “dword:00000000” to “dword:00000001”   More information can be found in this related article on stackoverflow.com