Quickly integrate with Sharepoint 2010

If you need fast access to Sharepoint 2010 through C# you should take a look at the LINQ to Sharepoint and the SPMetal tool. The SPMetal took generates a class library for all or some objects within the Sharepoint object model.

Quick guide:

  1. Open a DOS-prompt on the Sharepoint server
  2. Go to directory ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN’
  3. Type the following command: ‘SPMetal.exe /web:http://mysite /code:SiteEntities.cs’
  4. Add the SiteEntities.cs to you Sharepoint integration project
  5. Create a program for accessing the Sharepoint objects through LINQ

Code example:

public List<Injury> GetInjuries(
             DateTime? fromDate = null, DateTime? toDate = null
)
{
    var lst = new List<Injury>();
    SiteEntitiesDataContext context = 
         new SiteEntitiesDataContext("http://mysite");
    if (context != null)
    {
        List result = (
                from c in context.Injuries
                where c.OnDate >= fromDate && c.OnDate < toDate
                select c).OrderBy(x => x.OnDate).ToList();

        foreach (InjuriesItem inj in result)
        {
            var inj = new Injury(
                           inj.Id.Value, 
                           inj.Title, 
                           inj.OnDate.Value) ;
            lst.Add(inj);
        }
    }

    return lst;
}

The class Injury is defined in my integration solution an is not part of the  generated file SiteEntities.cs.

But one obvious disadvantage of this tool is the static behaviour. You need to generate the classes each time you change something to be able to reflect the changes in the integration.

Advertisements

Team Foundation Server 2010 tools

If you are an administrator of a TFS server (TFS = Team Foundation Server), you might need additional tools to administer and maintaining the server(s). The standard application “Team Foundation Administration Console” that is often not enough to get the total overview of the TFS installation. Here is some tools that help an administrator.

Team Foundation Server Power Tools September 2010 (download)

  • A diagnostic tool with a graphical user interface for analysing a TFS installation accouring to ‘Best Practices Analyzer’.
  • Alert explorer to for effecively maintaining check-in, work item change, or build completion.
  • Customized check-in policies to use to enforce software development practices during the check-in process.
  • Process Editor for enabling editing TFS process templates

Team Foundation Server Administration Tool (download)

The TFS Administration Tool allows Team Foundation Server administrators to manage user permissions on all three platforms utilized by Team Foundation Server: Team Foundation Server, SharePoint, and SQL Server Reporting Services. The tool also allows administrators to easily copy user permissions among team projects and to easily identify any missing permissions on any of the three platforms.

TFS PING (Download)
How to ping TFS to see if it’s up and running