Contributions, extension methods, utilities and other stuff that targets and contributes to the Microsoft SharePoint platform.

What is SharePoint Contrib?

In short, SharePointContrib is an assembly that you can either use at it is by downloading the latest release or having a look at the source code and just use that in your application.
I have, in as many places I could, tried to unit test my code so I can be as sure as possible that it works. I have used NUnit as my testing framework.

Why?

The code is just as much a repository of stuff that I have used in my applications as it is a codeplex project. I have been getting a lot of requests from my blog to publish the code somewhere.
At first I started zipping the examples and publishing them to my skydrive but after some time I also wanted to gather all my "utility" stuff in a common place so I created a local c# project which I named SharePointContrib (inspiration from other contribution projects).
So, finally I packaged it up and decided I might as well publish the code to codeplex and get some TFS support along for the deal.

As I said, you can use the code as it is or copy/paste it into your own code. If you find something wrong with it or have improvement feel free to tell me so I can update it.

Key Features

Extension Methods

To use the extensions you just add the following using statement in your code file.
using SharePoint.Contrib.Extensions;

Example:
TryFindListByName - aka FindListByInternalName
private void AddListItemToList()
{
   SPList list;
   if (site.TryFindListByName("mycustomlist", out list) == false)
   {
      list = CreateList();      
   }

   SPListItem item = list.Items.Add();
}

For detailed walk-through of the extension have a look at the documentation tab or click here.

Utility Classes

To use the utility classes you just add the following using statement in your code file.
using SharePoint.Contrib;

Example:
The LibraryBuilder
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPWeb site = properties.Feature.Parent as SPWeb;

            var books = site.CreateLibrary("books")
                                .Template("books")
                                .SupportsVersioning(true)
                                .CanBeCrawled(true)
                                .Description("These are the books in the book store")
                                .Title("Books")
                                .Cast<SPDocumentLibrary>();

        }

For detailed walk-through of the utility classes have a look at the documentation tab or click here.

Note:
Because this project was created from the basis of my own experiences you might have a look at my "personal" codeplex project at http://johanleino.codeplex.com for more detailed examples on how to use the things contained in this project.

Last edited Feb 17, 2010 at 3:58 PM by jole, version 13