Corey Roth and Friends Blogs

Group site for developer blogs dealing with (usually) Ionic, .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

Kyle Kelin on .Net

March 2009 - Posts

  • Improving This Blog

    I winding down on my current project and decided to spend some time improving my blog. The first step was downloading Live Writer. Using Live Writer instead of Word should reduce the friction of posting. In theory this should make me post more frequently.

    Another thing I did was sign up for Technorati which requires me to post their link here
    <a href="" rel="me">Technorati Profile</a>

    And the final step is to clean up my online presence a little bit. I started by updating bio on this blog but will also do that on other sites like twitter, delicious, linkedin, and facebook. And see if I tie all these together while making them consistent.

  • Slides and Code from SharePoint Saturday

    I ended up doing 3 sessions this past Saturday at the Tulsa School of Dev/ SharePoint Saturday put on by David Walker. I did two end-user sessions right after lunch, Document Library Basics and Introduction to InfoPath. After those I did a session over Unit Testing SharePoint with TypeMock. The turnout for that talk was smaller than I would have liked since David put me up against a Silverlight 3.0 talk. At the bottom of the post you will find slides and code for the unit testing session. If you want the InfoPath slides or example code just email me.

    DotNetMafia also had our second Beer and Code (SharePint) event.  Despite the snow, we still had some people turn out and we had a good time with plenty of food and beverages.  Our next event will be during Tech Fest 2009.  Thanks again to TekSystems for sponsoring the event.

  • Speaking In Tulsa This Saturday

    SharePoint Saturday is coming to Tulsa this weekend and I'm delivering two sessions. The first is an introduction to InfoPath and the second is Unit Testing SharePoint Code using TypeMock.

    Introduction to InfoPath
    New to InfoPath? This session will introduce you to InfoPath 2007. It will show you how to use the basic features of InfoPath to quickly and easily create data entry forms. You will learn how to bind dropdowns to SharePoint lists and xml documents. Also you will learn how to publish your forms to SharePoint so your users can fill them out and submit them through the browser.

    Unit Testing Custom SharePoint Solutions with TypeMock
    SharePoint solutions are made up of code and should be tested just like any other code base. Unfortunately some of the architecture choices made in the SharePoint Object Model limit a SharePoint developer's ability to unit test their code. This session will give an overview of mocking in general and then dive into how to use TypeMock to mock difficult dependencies like SPWeb and SPList. The session will also cover other types of testing besides unit testing including manual and integration tests.

    For those of you that were at Tech Fest last year, you might have heard about the epic Beer and Code event brought to you by DotNetMafia.  Well DotNetMafia is doing it again for SharePoint Saturday.  Beer and Code will be at Dirty's Tavern (just like last time) located at 325 E 2nd St (2nd and Elgin – Downtown Tulsa).  Update: We now have a sponser to pay for beer and food. Thanks Tek Systems!

  • Wrapping a SharePoint Choice Column with a C# Enum


    One thing I like to do in my SharePoint code is wrap the SharePoint Object Model code when I access a particular value in a Sharepoint list item. I do this so I can pretend like I'm not working with the SharePoint Object Model. :) I had a couple of choice columns that were represented as Enums in my code base this week. I wanted to share what that code looks like in case someone else might find it useful.


    The first method GetEnumValue is the method I am calling from my Data Access Layer (could be from the user control if you have fewer layers. The method takes the SharePoint listitem and the name of the column. I used generics in this method to make it more flexible so that it would take any Enum type so I wouldn't have to write a method for each Enum.



    public static T GetEnumValue<T>(SPListItem result, string columnName)


    string value = (GetItemValue(result, columnName));

    return (T)Enum.Parse(typeof(T), value);



    In the above method I used the method called GetItem. I use this little utility method to retrieve the value from the list item column


    public static String GetItemValue(SPListItem listItem, string columnName)


    string value = string.Empty;




    var itemValue = listItem[columnName];

    if (itemValue != null)

    value = itemValue.ToString();


    // catch ommitted for this examples

    return value;




    Here is how you would use the above GetEnumValue method. The Enum type is DocumentType and the column in SharePoint is also named DocumentType. Now you will need to wrap this line in your code that will access the list item. I will let you google that. There are plenty of posts on that.

    documentType = Utilities.GetEnumValue<DocumentType>(listItem,"DocumentType");


    Nothing earth shattering here but I found it useful and cleans up my code a litle bit.

Powered by Community Server (Non-Commercial Edition), by Telligent Systems