Archive for the ‘Technical’ Category

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

As most if not all of you already know, SharePoint 2013 and Office 2013 has been released to preview/beta and is available for download from Microsoft’s download centers. In this article I will briefly introduce some exciting changes that has been made to the SharePoint 2013 Business Connectivity Services framework. I’ve written a bunch of articles on BCS for SharePoint 2010, and now it’s time to continue that track and introduce the new features available in SharePoint 2013.

Please note that this article is written for SharePoint 2013 Preview, and for the final version of SharePoint some details may have changed

  1. SharePoint 2013: Business Connectivity Services – Introduction
  2. SharePoint 2013: Business Connectivity Services – Consuming OData in BCS Using an App External Content Type
  3. SharePoint 2013: Business Connectivity Services – Talking to your external lists using REST
  4. SharePoint 2013: Business Connectivity Services – Client Object Model
  5. SharePoint 2013: Business Connectivity Services – Events and Alerts

SharePoint 2013 – BCS with OData

In this specific article we’ll be looking on how you can consume data from an Open Data protocol (OData) data source. Tag along for the ride!

First of all, tell me what OData is…!?

Right, so OData is a  Web protocol for performing CRUD (Create Read Update and Delete) operations and utilizes technologies like HTTP, ATOM and JSON.

As quoted from the OData Web Site:

The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today.
OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores.

We can have lengthy discussions about how awesome (or unawesome) OData is but in this article we’ll be focusing on consuming OData data sources in SharePoint 2013 through Business Connectivity Services, one of my favorite parts of SharePoint.

Launch Visual Studio and get started!

So, as you probably could tell by the title of this post – you should now open Visual Studio 2012 :-)

Create the project

Choose the project type App for SharePoint 2013:

SharePoint 2013 bcs odata app

The Wizard that launches will give you a few choices which we’ll discuss in another article. In this article I’ve selected the “SharePoint Hosted” alternative, as you can see below:

SharePoint 2013 bcs odata app

This should get you setup with the initial project structure, and you should now have a project that looks something like this:

SharePoint 2013 bcs odata app project

Add an external content type

Now that we’ve created our initial project, we should add a new external content type. If you right-click your project and choose Add, you can see that there’s a new menu item called “Content Types for an External Data Source…“. Click it:

SharePoint 2013 bcs content type

In the following wizard, you can enter the service URL for the OData provider you’d like to consume. In my example I’ve used the public tv.telerik.com/services/odata.svc OData service:

Telerik OData in SharePoint 2013

In the next step in the wizard, you get to select for which data entities you want to generate external content types. Choose the entities you’d like to work with and continue by pressing Finish:
Please note that you should leave the “Create list instances for the selected data entries (except Service Operations).” checked so the tools can create your external list automatically!

SharePoint 2013 BCS Entity

After we’ve completed this step, we can see a few additions in our project that Visual Studio 2012 has been so kind to help us out with.

A Telerik Video external content type with it’s associated ListInstances (one per entity, in my case only one for Video) that it was also kind enough to create for us since I had the checkbox in the previous dialog ticked:

image

Looking in your Feature explorer, you can see that the default Feature now contains your artifacts along with the newly created List Instance and External Content Type:

image

In the newly created List Instances, the following XML has been generated for us:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListInstance Url="Lists/Video" Description="Video" OnQuickLaunch="TRUE" Title="Video">
    <DataSource>
      <Property Name="LobSystemInstance" Value="Telerik OData" />
      <Property Name="EntityNamespace" Value="TelerikTvDataServiceDataServiceModels" />
      <Property Name="Entity" Value="Video" />
      <Property Name="SpecificFinder" Value="ReadSpecificVideo" />
      <Property Name="MetadataCatalogFileName" Value="BDCMetadata.bdcm" />
    </DataSource>
  </ListInstance>
</Elements>

As you can see, the ListInstance DataSource node contains information about connecting to our newly created BCS entity. Perfect.

Just to make sure that we can deploy our solution, hit F5 and make sure that VS2012 deploys your project properly

Validate that your application works

Navigate to your site and validate that your new App is properly deployed and showing:

SharePoint 2013 app

Click the app and make sure you can see the result of your very basic and “hello world”-ish app:

image

Display your new external list!

Do you remember in one of the previous steps that I mentioned that you should leave the checkbox ticked in a dialog, saying “Create list instances for the selected data entries (except Service Operations).”? Well the reason for that is that we want Visual Studio 2012 tools to create this list for us so we don’t have to do that ourselves.

With the newly deployed BCS external content type app, with it’s created list, you can access the content of the list on the following URL (you’ll need to check your Elements.xml for your ListInstance element in order to find out your url:

http://yourappurl/ZimmergrenSP2013BCSOData/Lists/Video

Navigate to this URL and you’ll see this view:

SharePoint 2013 BCS OData Telerik Tv

So that’s pretty cool and easy right? Straight from the XML-formatted OData source we’ve pulled some info into our App in SharePoint.

Summary

As you can see, working with SharePoint 2013 and the OData model with BCS is pretty straight forward. In this example I created an App for SharePoint utilizing the BCS framework to connect to an OData data source. I’m pretty impressed with the options this opens up for many of our existing SharePoint 2010 projects that sometime in the future will be upgraded to SharePoint 2013.

In the next few posts we’ll dive more into the news around BCS for SharePoint 2013.

Enjoy.

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

As most if not all of you already know, SharePoint 2013 and Office 2013 has been released to preview/beta and is available for download from Microsoft’s download centers. In this article I will briefly introduce some exciting changes that has been made to the SharePoint 2013 Business Connectivity Services framework. I’ve written a bunch of articles on BCS for SharePoint 2010, and now it’s time to continue that track and introduce the new features available in SharePoint 2013.

At the time of this writing, I’m looking into details about upgrading a SharePoint 2010 solution to SharePoint 2013 for one of my clients who rely heavily on BCS – and the new features in 2013 are pretty slick – so I’ll be documenting and writing about some of the new enhancements for developers in this series!

Please note that this article is written for SharePoint 2013 Preview, and for the final version of SharePoint some details may have changed

  1. SharePoint 2013: Business Connectivity Services – Introduction
  2. SharePoint 2013: Business Connectivity Services – Consuming OData in BCS Using an App External Content Type
  3. SharePoint 2013: Business Connectivity Services – Talking to your external lists using REST
  4. SharePoint 2013: Business Connectivity Services – Client Object Model
  5. SharePoint 2013: Business Connectivity Services – Events and Alerts

SharePoint 2013 – Enhancing your BCS experience

After playing around and digging into the BCS playground for a while, these are some of the initial enhancements I’ve discovered and played with:

Support for OData in BCS

With SharePoint 2013 we now have access to the so called "Open Data protocol", or OData. This is a protocol that enables us to access data sources in a way that we haven’t been able to previously – using specially constructed URL’s.

Read more on OData here: http://www.odata.org/ecosystem

In the next article in this series, I will talk about how you can consume OData through BCS in a SharePoint 2013 solution. Stay tuned!

Events and Alerts from external systems

One of the features we’ve missed in a lot of our solutions built on BCS is the ability to simply hook up an alert or trigger an event when things happen in the BCS data source. In SharePoint 2013 this has been addressed and we now have the ability to actually trigger some events and subscribe to alerts. Exciting news indeed.

This is pretty cool and lets the external data source notify SharePoint about things that has changed and trigger some kind of action as a response to that. Read more about Events and Alerts for BCS

In one of the next articles in this series, I will talk about events and alerts more thoroughly and walk you through the process of creating a solution and subscribe to events happening in the data source. Happy times!

Building App-scoped External Content Types

Have you heard about the new App-model for SharePoint and Office? Well if you haven’t, go to Bing.com and perform a search for it and check it out – AWESOME!

Anyway, I’ve been looking a lot on Apps lately, and that obviously means a lot of thoughts coming together around the topic. One thing I’ve found that is pretty interesting, speaking of BCS, is that you can create an App-scoped external content type to consume external data. This esseitnally means that you don’t have to deploy your solution to the Farm anymore, but can deploy it as an App instead.

In one of the next articles in this series, I will talk about building App-scoped external content types. Until then, you can find more info here: App-scoped external content types in SharePoint 2013

Enhanced support for the Client Object Model / REST

Obviously one of the heavy pushes Microsoft is doing, is to focus a lot on the Client API’s. With this focus there has been some improvements in terms of working with BCS Entities from the Client Object Model as well. There has been some pretty neat enhancements, which I will discuss in one of the articles in this series as well. Until then, take a look here: Get started using the client object model with external data in SharePoint 2013

Summary

This is the first post laying out the topics of my next few BCS articles for SharePoint 2013. If there’s something you’d like to explore or talk about, feel free to drop a comment and I’ll see if it can make it into the article series.

Enjoy.

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

If you haven’t followed the trend today, you’ve most certainly missed out. The Office 2013 and SharePoint 2013 preview versions were released to the wild today. Steve Ballmer did a LIVE pressrelease where he revealed that the new versions of Office and SharePoint are now officially available for public beta consumption. This is pretty amazing news, so I’ll just leave you with the following information and links and you can be certain that I’ll update this blog regularly with content of SharePoint 2013 awesomeness from this day forth :-)

office15

Download the SharePoint 2013 preview binaries

You can find some of the relevant downloads right here:

SharePoint 2013 binaries

SharePoint Designer 2013 binaries

 

SharePoint Server 2013 SDKs

 

Microsoft Office Web Apps Server 2013

 

Duet Enterprise for SharePoint 2013 and SAP 2.0

 

Enjoy – and see you on the other side :-)

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

One of he culprits of working with the LINQ to SharePoint contexts that are being auto-generated for us is that it actually doesn’t necessarily render all the fields or properties you require. For example the built-in fields "Created By" or the "Attachments" property of a list item. Oftentimes we need these fields in our queries, whether they be CAML queries or LINQ queries. With LINQ to SharePoint you have the ability to extend an Entity that you’ve generated, and allow additional code to be executed for those entities. In this article I’ll talk briefly about how you can create and manage an extension to your LINQ context to allow additional fields in your queries.

One of the powerful advantages of doing this is that you post-deployment can extend your queries. Lets for example say that the list in your deployment gets some additional fields in the future, then perhaps you’ll need to make sure that your LINQ context can cope with querying those fields as well – this can easily be done by extending an entity context as I’ll talk about below.

In this article I’ll give you a sample of how to extend the LINQ entity to fit our custom needs, including mapping the "Created By" and "Modified By" fields and some additional logical customizations.

Generate your context

First and foremost we’ll need to generate our context. This can be done using SPMetal (Which you can read more about in this article: Getting Started with LINQ to SharePoint), or for example the extensions in CKS:Dev. I’m going to generate a quick and easy sample for this by utilizing the CKS:Dev tools and then build my samples on top of that.

If you haven’t installed the CKS:Dev tools yet, go right ahead and do that – then get back to this step!

1) Generate a LINQ context by using the CKS:Dev plugin, which will give you this additional context menu in the SharePoint server browser:

image

This should auto-generate a class file for you, containing all the entities for the selected site:

image

The file contains all the LINQ to SharePoint data context information that a normal SPMetal.exe command would generate, since this tool in essense is using SPMetal.exe:

image

As you can see, we’ve easily created the LINQ data context that we need, but unfortunately it’s missing some vital parts for our application – namely some of the built-in fields that you would normally want to work with. In my case, I was lacking the "Created By" and "Modified By" fields and I’d have to find a way to extend the LINQ context to cope with this so my queries can be easily constructed even for those fields.

Extending an entity in your generated LINQ context

In order for us to be able to extend the LINQ context, Microsoft provides us with an interface called ICustomMapping.

We’ll start by inheriting a new class from this interface, and name the class along the lines of the entity we want to extend.

// ----------------------------------------------------------------------- 
// <copyright file="AnnouncementExtension.cs" company="TOZIT AB"> 
// Awesomeness. 
// </copyright> 
// -----------------------------------------------------------------------

namespace TOZIT.Samples.ExtendingLinq 
{ 
    using Microsoft.SharePoint.Linq;

    /// <summary> 
    /// A LINQ extension to the Announcement-entity 
    /// </summary> 
    public partial class Announcement : ICustomMapping 
    { 
        public void MapFrom(object listItem) 
        { 
            throw new System.NotImplementedException(); 
        }

        public void MapTo(object listItem) 
        { 
            throw new System.NotImplementedException(); 
        }

        public void Resolve(RefreshMode mode, object originalListItem, object databaseListItem) 
        { 
            throw new System.NotImplementedException(); 
        } 
    } 
} 

Make sure you follow these rules:

  • Class name should be the same name as the entity you’re extending (partial class)

Let’s go ahead and add the necessary code to extend our entity. I’ll throw in some simple sample code here on how to map the fields we want, and to add additional logic to our new extension.

// -----------------------------------------------------------------------
// <copyright file="AnnouncementExtension.cs" company="TOZIT AB">
// Awesomeness.
// </copyright>
// -----------------------------------------------------------------------

namespace TOZIT.Samples.ExtendingLinq
{
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Linq;

    /// <summary>
    /// A LINQ extension to the Announcement-entity
    /// </summary>
    public partial class Announcement : ICustomMapping
    {
        #region Properties

        /// <summary>
        /// Gets or sets the Created Byproperty
        /// </summary>
        public string CreatedBy { get; set; }

        /// <summary>
        /// Gets or sets the Created By Login Name property
        /// Returns a reader-friendly version of the user's loginname
        /// </summary>
        public string CreatedByLoginName { get; internal set; }
        /// <summary>
        /// Gets or sets the Modified By property
        /// </summary>
        public string ModifiedBy { get; set; }

        /// <summary>
        /// Gets or sets the Modified By Login Name property
        /// Returns a reader-friendly version of the user's login name
        /// </summary>
        public string ModifiedByLoginName { get; internal set; }

        #endregion

        #region Methods

        /// <summary>
        /// Assigns a field (column) to a property so that LINQ to SharePoint can read data 
        /// from the field in the content database to the property that represents it.
        /// </summary>
        /// <param name="listItem"></param>
        [CustomMapping(Columns = new[] { "Editor", "Author" })] // Needs to be the InternalName of fields..
        public void MapFrom(object listItem)
        {
            var lItem = listItem as SPListItem;

            if (lItem != null)
            {
                // === MAP THE AUTHOR-FIELD ===

                // Map the Created By field to the Author (Created By) field
                CreatedBy = lItem["Author"].ToString();

                // Map the CreatedByLoginName field to the Author's actual LoginName
                SPField authorField = lItem.Fields.GetFieldByInternalName("Author");
                var authorFieldValue = authorField.GetFieldValue(lItem["Author"].ToString()) as SPFieldUserValue;
                if (authorFieldValue != null)
                {
                    CreatedByLoginName = authorFieldValue.User.LoginName;
                }

                // === MAP THE EDITOR-FIELD ===
                // Map the Modified By field to the Editor (Modified By) field
                ModifiedBy = lItem["Editor"].ToString();

                // Map the ModifiedByLoginName field to the Editor's actual LoginName
                SPField editorField = lItem.Fields.GetFieldByInternalName("Editor");
                var editorFieldValue = editorField.GetFieldValue(lItem["Editor"].ToString()) as SPFieldUserValue;
                if (editorFieldValue != null)
                {
                    ModifiedByLoginName = editorFieldValue.User.LoginName;
                }
            }
        }

        /// <summary>
        /// Assigns a property to a field (column) so that LINQ to SharePoint can save 
        /// the value of the property to the field in the content database.
        /// </summary>
        /// <param name="listItem">List Item</param>
        public void MapTo(object listItem)
        {
            var lItem = listItem as SPListItem;
            if (lItem != null)
            {
                lItem["Author"] = CreatedBy;
                lItem["Editor"] = ModifiedBy;
            }
        }

        /// <summary>
        /// Resolves discrepancies in the values of one or more fields in a list item with respect to its current client value, 
        /// its current value in the database, 
        /// and its value when originally retrieved from the database
        /// 
        /// Read more: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.linq.icustommapping.resolve.aspx
        /// </summary>
        /// <param name="mode">Refresh Mode</param>
        /// <param name="originalListItem">Original list item</param>
        /// <param name="databaseObject">Database object</param>
        public void Resolve(RefreshMode mode, object originalListItem, object databaseObject)
        {
            var origListItem = (SPListItem)originalListItem;
            var dbListItem = (SPListItem)databaseObject;

            var originalCreatedByValue =    (string)origListItem["Author"];
            var dbCreatedByValue =          (string)dbListItem["Author"];

            var originalModifiedByValue =   (string)origListItem["Editor"];
            var dbModifiedByValue =         (string)dbListItem["Editor"];

            if (mode == RefreshMode.KeepCurrentValues)
            {
                // Save the Current values
                dbListItem["Author"] = CreatedBy;
                dbListItem["Editor"] = ModifiedBy;
            }
            else if (mode == RefreshMode.KeepChanges)
            {
                // Keep the changes being made
                if (CreatedBy != originalCreatedByValue)
                    dbListItem["Author"] = CreatedBy;
                else if (CreatedBy == originalCreatedByValue && CreatedBy != dbCreatedByValue)
                    CreatedBy = dbCreatedByValue;

                if (ModifiedBy != originalModifiedByValue)
                    dbListItem["Editor"] = ModifiedBy;
                else if (ModifiedBy == originalModifiedByValue && ModifiedBy != dbModifiedByValue)
                    ModifiedBy = dbModifiedByValue;
            }
            else if (mode == RefreshMode.OverwriteCurrentValues)
            {
                // Save the Database values
                CreatedBy = dbCreatedByValue;
                ModifiedBy = dbModifiedByValue;
            }
            
        }

        #endregion
    }
}

As you can see in my sample above, I not only mapped the two fields I need but I also slightly extended the entity with additional properties for retrieving a clean LoginName from the user-objects. Obviously this can be done using a normal .NET 3.5 extension method on the SPUser object, but here I implemented it in the context to show how it can be easily extended to fit our needs.

Writing a query with our extended data context

So if we’ve followed the very simple steps of creating a new extension for one of our entities, we can now easily access these details from the query we’re writing:

image

using System.ComponentModel; 
using System.Web.UI.WebControls.WebParts; 
using Microsoft.SharePoint;

namespace TOZIT.Samples.ExtendingLinq.LinqWebPart 
{ 
    using System.Linq; 
    using System.Web.UI.WebControls;

    [ToolboxItemAttribute(false)] 
    public class LinqWebPart : WebPart 
    { 
        protected override void CreateChildControls() 
        { 
            using (var ctx = new SocialflowDataContext(SPContext.Current.Web.Url)) 
            { 
                // Fetches the items where the current user is the creator 
                var myItems = from item in ctx.Announcements 
                                  where item.CreatedByLoginName == SPContext.Current.Web.CurrentUser.LoginName 
                                  select item;

                foreach (var item in myItems) 
                { 
                    Controls.Add(new Literal { Text = item.Title + " : " + item.CreatedByLoginName + " (you) created this item<br/>" }); 
                } 
            } 
        } 
    } 
} 

The list contains a few items (all created by the current user, which is the system account – please use your imagination… :-)   )

image

And the results:

image

Summary

All in all, this gives us the flexibility to customize the way we do our queries in SharePoint using LINQ. I’ve gotten the question about extending LINQ to SharePoint quite a few times over the past years, so I thought it’d be time to reflect those thoughts in this post. I hope you enjoy it and can start utilizing the extension of your LINQ queries!

Enjoy!

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

A while back an announcement was made that TFSPreview.com had been made available for general testing. Various bloggers at Microsoft put an invitation token in their MSDN blogs so everyone can have a go at it.

In this article series we’ll take a very quick look at what the hosted TFS solution by Microsoft looks like.

Articles currently in the series:

Steps to hook up a project to your new build server

This article obviously assumes that you’ve already followed along with the previous articles and hooked up a build configuration for  your TFSpreview account. Now we’ll take a look at how we can get our projects hooking up in a CI/Automated Build scenario with Team Foundation Services.

The steps from this point onwards are basically the same as if it would be an on-premise TFS server in your own domain. Your build server is configured, your code is hosted in TFS and all you’ll need to do is connect your project to the actual TFS and then create a new build definition.

Create a new project (or connect an existing one) and connect to TFS

We’ll start from the beginning and create a new Visual Studio 2010 project (in my case it’ll be an Empty SharePoint Project), and remember to tick the Checkbox "Add to source control":
image

Make sure that the project is connected to your TFS server, check in the source and we can get started:
image

Create a new build definition

At this point (if you’ve followed the articles in this article series) you should have a TFS server, a connection from Team Explorer to your TFS server and also a new project hooked up in your repository. Now its time to create our first build definition so we can automate the builds and deployments.

Start by navigating to your Team Explorer and right-click on Builds and then click the "New Build Definition…":
image

This will give you the following new dialog where you can specify details for your build:
image

Move on to the "Trigger" tab. In my case I want to enable CI (Continous Integration) for my project:
image

Move on to the "Workspace" tab. In my case I’ll leave the Source Control Folder as the default root as seen below. You can choose to specify a specific TFS project if you don’t want to include all.
image

Move on to the "Build Defaults" tab. You’ll need to specify a build controller (you should have one here since we created one in the previous article). You will also need to specify a drop folder, where your binaries are going to be delivered upon the build: 
image

Move on to the "Process" tab. This is where things get really interesting. You can from this dialog specify a variety of different variables for your project when it builds. I’m not going to dig into details here because my good mate Chris O’Brien have covered all of that in his article series about automated builds.
image

Save the build definition and validate that it appears in the Team Explorer:
image

Test the build configuration

In order to validate that our setup now works with TFSpreview.com and our own build server and to validate our newly created build definition, simply make some changes to your project and check it in and have it automatically schedule a new build (We chose Continuous Integration, which will build on each check in). You can see that the build is now scheduled and currently running:
image

And after a while you can validate that it is Completed:
image

The final validation is of course to see the drop folder that we specified and make sure that it now contains our newly built sources:
image

Voila. Build seems to be working.

Summary

This post was intended to give you an overview over the simplicity of creating a simple build definition and getting started with automated builds in TFSpreview (hosted Microsoft TFS). Pretty neat and it seems to be working just the way we want.

Obviously there’s some apparent questions like:

  • What if I want to output my .wsp files as well?
  • What if I want to execute a specific script upon the execution of the build so I can automate test-deployments?
  • Etc. etc.

My first recommendation is to visit Chris O’Brien and read all the posts in his CI/automation series which is simply amazing.

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

A while back an announcement was made that TFSPreview.com had been made available for general testing. Various bloggers at Microsoft put an invitation token in their MSDN blogs so everyone can have a go at it.

In this article series we’ll take a very quick look at what the hosted TFS solution by Microsoft looks like.

Articles currently in the series:


Getting your first scheduled build up and running

In order to get a scheduled build that talks to your TFSPreview repository, you’ll need to follow these steps and make sure the prerequisites are fulfilled.

Prerequisites

Note: If you don’t have SharePoint 2010 installed, the installer have an option for installing SharePoint Foundation 2010 for you. In my case however, I’ve got SharePoint Server 2010 Enterprise running already.

Installing the package

First of all, launch the ISO file that was extracted from the downloaded package and you should see this screen:
image

We want to install Team Foundation Server before we proceed, so choose the first option under the Install headline, which will bring you to this dialog:
image

You’ll need to accept the EULA and if you’re awesome you’ll keep the second checkbox checked so Microsoft can review any issues that may be encountered during the process so they can have a look at them pre-RTM. Click Continue and then click Install Now in the dialog that follows:
ScreenShot1300

You may or may not need to reboot the computer while it’s performing the installation, depending on whether you’ve had some of the prerequisite artifacts installed prior to the installation or not.

Now just sit tight for a while as the installer takes care of the installation for you. Grab a newspaper, get a coffee, check some important stuff on Twitter or simply multitask with other things while you wait.

When it’s done, you’ll have a few options of what type of installation you want to do:
image

Please note: At this point you have several options for how to proceed with your installation. You can now choose one of the following installation options:

  • Configure Team Foundation Application Server
  • Configure Team Foundation Server Proxy
  • Configure Team Foundation Build Service
  • Configure Extensions for SharePoint Products

In my case I’ll be choosing the "Configure Team Foundation Build Service" since I only need the actual Build Agents and Build Service – the TFSpreview.com is hosting the actual TFS server.

Next step will present you with a dialog like the following, where you’ll have to choose what default team project collection to utilize for the build server. Since we don’t have TFS installed the box is currently empty, but fear not for your TFS server is hosted in the cloud (tfspreview.com, remember?) so we’ll just have to go and add that connection as well.

Click the "Browse…" button to open the dialog for choosing your TFS connection
image

If you haven’t already connected to a TFS server, this dropdown will be empty. Click "Servers…":
image

Click the "Add…" button:
image

Finally enter the URL to your TFS collection and click "OK":
image

You will see a dialog that enables you to log in to the services (use the Login details you signed up with for tfspreview.com):
image

When the sign-in is completed you’ll see that you now have a list of TFS collections. Choose your DefaultCollection (or otherwise) and click "Connect":
image

It should hopefully say something like this, telling you there’s no build servers unless you’ve already configured it previously:
image

In the next dialog I’ll choose "Use the default setting" for my setup:
image

In the next dialog you’ll have to choose credentials for your build rig. I’m using a dedicated domain account called SHAREPOINTSPBuild:
image

Make sure you validate the configuration and then press "Next"
image

If awesomeness is found on your machine, it should look something like this:
image

Click the "Configure" button and let the installer have its way for a while. Hopefully all these fancy green icons will show you that things went smoothly:
image

With that done, in the next dialog you’ll see a nice "Success" message and you’re ready to start creating and work with your build agents:
image

Validate the Build Server

On your Start Menu, you should find the following new shortcut:
image

Clicking the "Team Foundation Server Administration Console" should bring you forth the following dialog where you can validate that your machine is properly up and running with a build server and agents. Click the "Build Configuration" option in the menu to the left and make sure your build agents are running under the controller:
image

Summary

If you’ve followed along with the steps in this post you’ll see how easy it is to get up and running with creating a build server (controllers+agents) for your TFS. In this case, I chose to do a connection to the TFSpreview-hosted TFS account.

In my next post in this series I’ll talk about how you can create a new build from Visual Studio 2010 from your dev-machine and have it automatically build on this build server. Gotta love automation!

Enjoy.

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

A while back an announcement was made that TFSPreview.com had been made available for general testing. Various bloggers at Microsoft put an invitation token in their MSDN blogs so everyone can have a go at it.

In this article series we’ll take a very quick look at what the hosted TFS solution by Microsoft looks like.

Articles currently in the series:


Connect Visual Studio 2010 to your new hosted team project

In order to be able to connect to the hosted TFSPreview team project, you’ll need to comply with the prerequisites I’m listing here.

Prerequisites

Hook up Visual Studio to your new repository/project

Alright, if you’ve downloaded and installed KB2581206 (which means you’re spinning VS2010 SP1 already) you are read to connect. The procedure to connect to the hosted TFS service is basically the same as if you were to connect to any other TFS repository, which is easy and awesome.

In Visual Studio 2010 SP1, simply make these smooth ninja moves and you’re done:
image

Make sure to fetch the URL of your account (As seen in your dashboard, like depicted below):
image

Enter this URL in the Visual Studio 2010 dialogs and we’re ready to kick off:
image

It’ll ask you for your credentials which you need to use to verify your account details:
image

You should now be authenticated and your repository should be available:
image

You’ll go ahead as you normally do and choose the projects that interests you and then you’re basically done:
image

Your Team Explorer should contain your TFS project and you should be able to work with it as you normally would from Visual Studio 2010:
image

This means you’ve got all of your standard tasks and operations available straight from VS 2010 (So you don’t have to go to the website to make changes …):
image

Summary

Easy enough. As soon as you’ve downloaded the required tooling to get connected, you can hook up your new cloud-hosted team project in Visual Studio 2010 without any problems. Give it a spin, it flows quite nicely!

Enjoy.

Author: Tobias Zimmergren | www.tozit.com | @zimmergren

Introduction

Sometimes when you’re in a development project you can feel the pain of debugging. If there’s a lot of code floating around it may be hard to sort out the method calls and how the depend on each other if it’s a very complex solution. To ease the task of debugging there’s a great VS 2010 plugin called Debugger Canvas, which will help you to sort out a lot of the hassle while debugging.

In this article we’ll just take a quick look at what Debugger Canvas is and how it can assist us in our daily debugging adventures.

Getting Started with Debugger Canvas

Firstly, you obviously need to download the extension for Visual Studio 2010, which can be done HERE.

Please note: The Debugger Canvas Extensions are only available for VS 2010 Ultimate

Debugger Canvas in Action

When you’ve installed the extension, there’s a few new opportunities presented when debugging. Your new “F5” experience will be based on the new Debugger Canvas UI instead of the traditional debugging experience which means you’ll be able to more easily follow the calls within your code, like this:

image

When you step into the code deeper, you’ll see how the calls were made quite easily:

image

Summary

You should definitely take a look at Debugger Canvas if you haven’t already as it’ll be most helpful for you in your development adventures.

Get a better overview here and watch the introductory video!

Enjoy.

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

In most of my recent projects I’ve been required to hook up some custom functionality and add custom forms, pages and Web Parts. Some of the forms and pages I designed needed to be launched from the Ribbon menu, which of course is contextual. This basically means that when you visit a specific list which inherits from a specific content type, we can choose to display our custom Ribbon controls. One of the most common requirements I bumped into was having some kind of conditional check whether to enable or disable the button based on a set of conditions.

In your Ribbon XML for the CommandUIHandler there’s a property called “EnabledScript” which is a tag that enables you to enter a validation script to determine whether or not the ribbon button should be enabled. In my case I need to disable the custom Ribbon-controls if one item is selected, but otherwise always disable it.

Use the following snippet from the SP.ListOperation, which contains the Selection.getSelectedItems method:

<CommandUIHandler
Command=”Ribbon.Awesome.NavButton_CMD”
CommandAction=”javascript:Alert(‘My Awesome Button Was Clicked’);
          EnabledScript=”javascript:SP.ListOperation.Selection.getSelectedItems().length == 1;” />

It’s really only the last line that is of interest here since that’s where the script magic happens to determine if the control should be enabled or not.

MSDN have some nice samples in one of their articles over here.

Results

If you select one (and only one) item in the list, your custom command will be enabled:

image

If you didn’t select or selected more than one item, the command will be disabled as such:

imageimage

Summary

I know many people have been struggling with the Ribbon and making it behave. In this article I simply wanted to highlight one of the very common tasks I’ve seen developers looking for and trying to achieve in some of the last few projects I’ve been involved.

Since my awesome mate Wictor covered a bunch of awesome posts about the Ribbon, I’m not going to dive into any more details than so :-)

Enjoy.

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

A while back an announcement was made that TFSPreview.com had been made available for general testing. Various bloggers at Microsoft put an invitation token in their MSDN blogs so everyone can have a go at it.

In this article series we’ll take a very quick look at what the hosted TFS solution by Microsoft looks like.

Articles currently in the series:


What we need to know before getting started…

Firstly you’ll need to get an invitation token from someone who already have an account on tfspreview.com and then you’re good to go. In this post I’ll assume that you’ve got that already.

Sign in to the TFSpreview account you just acquired:

image

This should give you access to the Team Foundation Service Preview console:

image

From here you have a few options for proceeding:

  • Create a team project – The first step to create a new TFS site and project
  • Download software – You’ll want to visit this link so you can download the required software for connecting from VS 2010, if you haven’t already.

To guide you through the process of getting up and running, I’ll create a new project and call it "TOZIT AB Project 42" so you can follow the sample this article through.

Getting Started – Step by step

Right, so you’ve got your account set up and want to create a project. Follow along and I’ll take you through the entire process. Hang on.

Click "Create a team project":

image

Next you’ll get a dialog telling you the progress of setting the new project up:

image

When this is done you can navigate directly to the project or click close. I pressed close and made sure I could see the team project in my project list when I press "Browse all…":

image

Simply click on the "Navigate" button to navigate to the project and you should see your team project dashboard, similar to this:

image

What you get here is the intro to your Project. You can see in the top menu that you’ve got options for these things:

  • Home (This is what you see above)
  • Work
  • Source
  • Build

HOME

As depicted in the screenshot above, this is the welcome screen of the currently selected project. From here you can control your Product Backlog, Product Backlog Items, Sprints, Work Items and so on. Think of this as your online control panel for the Scrum project. Pretty neat, if you ask me.

WORK

Under the "backlog" tab:

image

You’ll get a more detailed overview over you current situation in the project including the Product Backlog, Sprints and Work Items with an overview as well as detailed information about each item you select. From here you can control, create and modify your current project quite easily from the Web Browser.

For example, you can create a new PBI (Product Backlog Item) from here:

image

and it’ll immediately appear in the list below, and you can start working with it:

image

I’m obviously not going to walk you through each and every button on these pages, that’s for you yourself to try out, but this should give you an overview and idea of what’s available.

Under the "board" tab, you can easily get a really awesome overview of your current status in the project with all your Product Backlog Items in the selected sprint. You can easily drag and drop these items from one to the other section:

image
(Pretty awesome…)

Of course you can edit everything from the browser UI here as well:

image

Under the "work items" tab you can get a more familiar overview of the current work items, and even create you own queries in the section to the left – much like you would do from Visual Studio otherwise:

image

SOURCE

Under the Source tab you can see (perhaps one of the most important things) the source code of your project including the history, changesets, shelvesets and so on:

image

BUILD

An overview of your current build configurations. In this post I haven’t set up any build configurations yet, but keep your eyes out for that soon enough.

image

Summary

This was intended to be a short introduction of what capabilities and features you’ll see in the hosted Team Foundation Services 2010 hosted service. More on this subject to follow!

Enjoy.