Monthly Archives: June 2009

SharePoint Application Development the Free and Easy Way

These resources accompany a presentation at the Western New York Dot Net Users Group (WNYDNUG):

So what does the title of this presentation really mean?

By SharePoint, I mean Windows SharePoint Services 3.0 (WSS 3.0) not to be confused with MOSS2007 which adds features on top of WSS 3.0 and requires licenses.

By Application Development, I don’t mean canned features that work right out of the box, but additional web parts, web pages, and functionality that require the skill of an intermediate ASP.Net web developer.

By Free I mean that in addition to the free WSS 3.0 platform, all the development tools used in the presentation are also completely without cost.

And by Easy I mean ‘easier’ than the way I used to develop SharePoint solutions years ago. Unfortunately, developing SharePoint using the standard, documented methods and templates is really, really, really, really, really, really (so glad I got that thesaurus), really, really, hard. And when I began to settle on a set of tools and techniques that relieved my pain, I got kind of excited and decided to do a presentation. Enjoy.

Resources:

Windows SharePoint Services 3.0 SP1 Developer Evaluation VPC Image

…Windows Server 2003, WSS 3.0, Visual Studio 2008 Pro with extensions for SharePoint, Silverlight, and Ajax, SharePoint Designer 2007, Office 2007, and… (I’m seriously impressed they did this) a shortcut to Notepad already added to windows’ right-click ‘Send To’ menu!!!!!

SmartPart

This turns the nightmare of Web Part development into a dream. 

ASP.Net apps in the _layouts folder

You’re an ASP.Net developer. Now act like one! Using this technique, you can just deploy your standard asp.net web apps right to SharePoint.

MVC apps in SharePoint

Similar approach to asp.net in _layouts, but with the magic of MVC.

U2U CAML Query Builder

When CAML makes you cry, CAML Query Builder will dry your tears.

OfficeToolbox.SharePoint.Lists

Sometimes all you really want is for SharePoint lists to have a teensy bit more functionality (hide columns, move column descriptions around). Here ‘ya go.

SharePoint Features

Added features (list printing, user management, turn stuff off on List Toolbars, and much more) from a community on codeplex. Woah! Scot Hillier put these together; that’s a name you can trust in SharePoint development.

Tool Basket

Another Codeplex community project. The easy Form Designer alone is worth the expense (what! it’s free??)

 Roger Lamb – Common Coding Issues When Using the SharePoint Object Model

As soon as you’ve written enough code with SharePoint Object Model to be dangerous, you owe it to yourself to review it against this set of guidelines

Jan Tielens

Jan was the first one to nudge me in the right direction with SmarPart. He continues to provide lots of fresh ideas; JQuery techniques as of late.

SmartTools

In addition to SmartPart, Jan also made these numerous additions to SharePoint features available on CodePlex (check out the slick charts!)

Manage large SharePoint lists for better performance

Eventually you may end up with a lot of data (items in lists). It’s possible to have a list with millions of items, but it’s best not to exceed 2,000 items per ‘container’ (root or folder). It’s also advised not to select more than 2,000 items at a time. If you’re handling 5,000+ items at a time, you’re really asking for trouble, as MS SQLServer may lock the whole table. That’s THE TABLE; the one and only table that holds every item for every list in every site of your SharePoint collection. Youch!

SharePoint development the “right” way

Finally, if you’re producing apps commercially, or deploying to environments that enforce stricter standards, you may be forced to develop SharePoint the “Right” way. You’ll need to learn the intricacies of web part plumbing and architecture, you won’t have drag-n-drop controls, and to properly deploy all this, you’ll need to build WSP Solution Packages which contain numerous files which must be configured properly and end up in all the right nooks and crannies of the web server (12 hive, GAC, bin, etc.). Deployment typically forces a restart of your site, too.

To get a full picture of what’s involved in building and deploying a WSP Package WITHOUT the ease of the short-cuts and tools provided above see this example project: http://www.codeproject.com/KB/sharepoint/WebParticles.aspx.  I like this example because it perfectly illustrates the complexity involved, but also provides a guide to building your own UserControl wrapper (like SmartPart).

The following tools from Microsoft and Codeplex will help with developing and deploying applications as WSP Solution Packages.

VSeWSS 1.3 CTP

…hey, how’s that for a bunch of letters and numbers thrown together (the lower case ‘e’ is a nice touch, too)! These are Microsoft’s extensions for Visual Studio 2008 to help with developing and deploying SharePoint Web Parts and such. And it only took me like 3 hours to install and configure correctly *sigh*.

These screencast demos might help too (they make it look sooooo easy)

http://channel9.msdn.com/posts/kirke/

…but over the years, developer communities weren’t waiting around for Microsoft, and these two tools have become the de-facto standard for SharePoint development and deployment.

WSPBuilder

STSDEV

s

Technical Notes: 

  • Smart Part User Controls are kept in:
    C:InetpubwwwrootwssVirtualDirectories80UserControls
  • Custom ASP.Net web applications are kept in:
    C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS
  • If you have supporting libraries in your layouts web projects, you should set their build output to go to:
    C:InetpubwwwrootwssVirtualDirectories80bin
  • Another gotcha I experienced. Once, when I deployed SmartPart, some of the samples didn’t run for a couple reasons. 1. if you’re using ajax enabled controls, you have to make sure you’ve got all that ajax.net stuff configured and that there’s a script manager somewhere in the page or master page. 2. The windows permissions on the sample ascx files, themselves got messed up when I was copying the samples, and I got Access Denied errors. ‘Touch’ the permission on those files, or maybe copy and paste the contents into new file and those errors should clear up.
  • If you plan on inserting updating deleting list items, you’ll probably run into security errors. The file to adjust is:
    12CONFIGwss_mediumtrust.configFor details on this and MANY OTHER ‘tips and tricks’ see:
    http://msdn.microsoft.com/en-us/library/dd583162.aspx?ppud=4
  • In the custom web applications you add to the layouts folder, the app will barf if your web.config has this line:
    <authentication mode=”Windows” />, so comment that out.
  • Also, regarding web.config, keep in mind that to take advantage of LINQ and new c# 3.5 language features, the default web.config may not up to snuff, so you’ll probably have to add a few settings to get that working. Here are settings I added recently to a ‘new’ setup of a VPC to get my code examples running….<compilation><assemblies>
     <add assembly=”System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>
     <add assembly=”System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/>
     <add assembly=”System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>
     <add assembly=”System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>
     <add assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C”/>
    </assemblies><compilation>…<system.codedom>
      <compilers>
       <compiler language=”c#;cs;csharp” extension=”.cs” warningLevel=”4″ type=”Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″>
        <providerOption name=”CompilerVersion” value=”v3.5″/>
        <providerOption name=”WarnAsError” value=”false”/>
       </compiler>
       <compiler language=”vb;vbs;visualbasic;vbscript” extension=”.vb” warningLevel=”4″ type=”Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″>
        <providerOption name=”CompilerVersion” value=”v3.5″/>
        <providerOption name=”OptionInfer” value=”true”/>
        <providerOption name=”WarnAsError” value=”false”/>
       </compiler>
      </compilers>
     </system.codedom>…<runtime>
      <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
       <dependentAssembly>
        <assemblyIdentity name=”System.Web.Extensions” publicKeyToken=”31bf3856ad364e35″/>
        <bindingRedirect oldVersion=”1.0.0.0-1.1.0.0″ newVersion=”3.5.0.0″/>
       </dependentAssembly>
       <dependentAssembly>
        <assemblyIdentity name=”System.Web.Extensions.Design” publicKeyToken=”31bf3856ad364e35″/>
        <bindingRedirect oldVersion=”1.0.0.0-1.1.0.0″ newVersion=”3.5.0.0″/>
       </dependentAssembly>
      </assemblyBinding>
     </runtime>…

 

 

  

Hope this all helps.

Cheers!

-Denise