Sunday, November 1, 2009

Programming concepts of Microsoft SharePoint2010 - for developers

One of the most exciting developer feature for me in SharePoint 2010 is LINQ. It basically provides a consistent, strongly-typed way of dealing with entities in your data. In SharePoint’s terminology, this means webs, lists and list items. Consider the below example:

Previuosly with SharePoint 2007 PObjct model code:
using (SPSite site = new SPSite("http://MySharePoint2010Site.com")
{
     using (SPWeb personalWeb = site.OpenWeb("/PersonalSite"))
    {
          SPList announcementsList = personalWeb.Lists["Announcements"];
          foreach (SPListItem announcementItem in announcementsList.Items)
         {
             DateTime expires = DateTime.MinValue;
             if (DateTime.TryParse(announcement["Expires"].ToString(), out expires))
            {
                         // here comes the value for
            }
        }
    }
}
 
With SharePoint 2010 object model code using LINQ:
// Get DataContext from page context
DataContext data = new DataContext(SPContext.GetContext(this.Context).Web.Url);
EntityList Announcementslist = data.GetList("Announcements");
         var AnnouncementItems = from announcements in Announcementslist
                                                  where announcements.Title == "New Announcement"
                                                  select announcements;

foreach (var ann in AnnouncementItems)
{
             Page.Response.Write("id = {0}, Title = {1}", ann.CustomerId, ann.Title);
}

LINQ provides your data access abstraction for free. In addition, other data access scenarios such as inserting/updating list items and querying lists (think SPSiteDataQuery or SPQuery) will also be simplified. If you don’t already, my advice would be to start to understand fundamental aspects of how LINQ works

 Recommended reading:
jQuery:
Another innovation in SharePoint 2010 is the client object model, which allows us to work with SharePoint data on the client (e.g. in JavaScript or Silverlight) in much the same way as we’re used to in .Net code on the server. In the case of JavaScript, jQuery will be useful here (though certainly not mandatory) because of the script which will frequently surround your use of the client OM. Put simply, whatever kind of objects you’re using in JavaScript, if you’re interacting with page elements jQuery is likely to reduce and simplify the code required.
Recommended reading :
jQuery in Action

PowerShell 
PowerShell will play a greater role in SharePoint than previously courtesy of the many cmdlets included in the product – certainly admins who are script-inclined are likely to be very happy. The draw here is the sheer power – PowerShell is known for being able call into the .Net framework (and your own custom code), but is also capable of dealing with the filesystem, registry etc. This means that PowerShell can be used for a variety of SharePoint related tasks – scripted installations, configuration scripts, site provisioning/updates and more.
Recommended reading:
Silverlight
Whilst it wouldn’t necessarily have been difficult for skilled developers to build a custom web part to render Silverlight movies, it’s an indication of Microsoft’s desire to make it easy to build rich sites that Silverlight web parts are included in the SharePoint 2010 box. Having had to integrate Flash movies from other teams with XML data sources in the past, having this kind of technology on the “Microsoft developer” side of the fence is pretty appealing. If you have the skills you’ll be able to build web parts with killer user interfaces, and assuming Silverlight is available to your audience the whole SharePoint world will be able to use them.

 Recommended reading:
FAST search
You’ve probably heard that SharePoint Server 2010 has native integration with FAST search technology. If you’ve seen the capabilities of FAST and/or had conversations with clients about going beyond a ‘standard’ implementation of search, you’ll know how exciting this is. On my last project I worked with some guys from FAST on a proof-of-concept with extremely custom integration between SharePoint/FAST, so it’s great to see the barrier to entry being lowered here. For many, seeing the art of the possible in this space is a real eye-opener – often you don’t realise what you’ve been missing until you see it. On this one, my main recommendation at this stage is solely to introduce yourself to the concepts used by FAST such as the document processing and query pipelines, dictionaries, entity extraction and so on.

 Recommended reading:
WCF
SharePoint’s own web services are now WCF services, but also because if you ever want to build a service application in SharePoint 2010, you’ll need to do WCF work. In general terms, it’s good advice that all new .Net web services should be built using WCF (.svc) rather than as .asmx web services anyway.
Recommended reading:

No comments:

Post a Comment