Tech·Ed Africa 2010: Want to go for free?

Submitted by Robert MacLean on Tue, 08/24/2010 - 09:53

Win 1 of 4 Tickets to Microsoft Tech·Ed Africa 2010 worth R6 150 each!!!

Venue:    ICC Durban

Date:       17th - 20th October 2010

All you need to do is take a photo of a Microsoft Tag in a really cool/funny/practical place and upload the picture to the Facebook competition page.

More details in the competition animated video here.

Full Competition Rules on our Facebook page.

Dates for Submissions & Announcements of Winners:

  • 25 Aug 2010    -    Last Date For Submissions (week 1) (5pm)
  • 27 Aug 2010    -    Week 1 Winner Announced
  • 01 Sep 2010    -    Last Date For Submissions (week 2) (5pm)
  • 03 Sep 2010    -    Week 2 Winner Announced
  • 08 Sep 2010    -    Last Date For Submissions (week 3) (5pm)
  • 10 Sep 2010    -    Week 3 Winner Announced
  • 15 Sep 2010    -    Last Date For Submissions (week 4) (5pm)
  • 17 Sep 2010    -    Week 4 Winner Announced

Submissions & Announcements of Winners:

  • A new winner will be selected weekly.
  • Last date for submissions for a particular week is 5pm Wednesday of that week.
  • Winner for that week will be announced on the Friday.
  • Submissions after 5pm will count towards the following week.
  • Submissions which did not win in a previous week will still be considered in following weeks and need not be re-submitted.
  • A person can only win once, thereafter all his other submissions will be ignored.
  • You cannot submit on behalf of another person.
  • Submissions are done by posting a photo to the Facebook page wall.

Terms and Conditions apply:

This competition is limited to Tech·Ed Africa 2010 entrance and does not include Travel, hotel or any other expenses. You will be required to help out at the Developers Community Lounge at Tech·Ed Africa 2010 for 3 hours a day if you do win. For Full list of rules please consult the Facebook page.

It's Dev4Dev's time again!

Submitted by Robert MacLean on Fri, 08/20/2010 - 09:30

My favourite gathering of developers happens 2 or 3 times a year, it’s called Dev4Devs. This is a free event which Microsoft runs, where ANYONE can present a topic but they only have 20min! This means that in a morning you see 7 topics and rather than getting swamped in all the details you dive directly to the really important parts.

The topic list is below, and there is some exciting topics there and even some non-MS technology is covered too!

I am also really glad that the entire ATC team at BB&D, which is the team I work in, is presenting – they are highlighted in the list below!

The next one comes on the 4th September 2010 and it occurs at Microsoft’s offices in Johannesburg and you can register at

Session List for Dev4Devs

Windows Phone 7 - Getting Started

A high level introduction to getting started with Windows Phone 7 development including: where to begin, options for developers, thinking about design and a demonstration application.

Presenter: Johannes van Schalkwyk

Making MVVM easy

Starting with WPF, Silverlight or WP7? Heard of MVVM but think it’s WAY too complex for your simple application? Join me for a crash course using the easiest MVVM framework available… Caliburn.Micro!
Presenter: Rudi Grobler (ATC Team Member)

Why you should care about Google Closure

Closure is a modularised set of JavaScript libraries that can assist you in building rich internet applications.

It's been battle-tested by Google on sites like: Gmail, Google Docs and Google Maps.

Attend this short intro to get an understanding of how important these libraries are and why you should consider using them in your next big internet app.

Presenter: Simon Stewart

Introducing NHibernate 3

The daddy of .NET ORM is back with a new release, in this session you'll see a few of the newest features - such as a full IQueryable LINQ provider - that makes NHibernate 3 the best release yet!
Presenter: Kevin McKelvin

Branding SharePoint 2010 with MasterPages, Layouts and CSS

One of the largest limitations of WSS3.0 and MOSS2007 is the ability to brand SharePoint without intricate knowledge of the platform and in some cases breaking a few rules and modifying out of the box system files to get the desired look and feel. Come and see how the theming engine in SharePoint 2010 together with CSS, Master Pages and Layouts can be used to brand your SharePoint site using the amazing new SharePoint Designer 2010.
Presenter: Brent Samodien

Unit Testing - Code Coverage & Mocking

In this presentation William will demonstrate how code coverage tools help measure the effectiveness of your unit tests.  He will also show how Mocking tools can help to add value to your unit tests and ensure that all edge-case logic is properly checked.
Presenter: William Brander (ATC Team Member)

Getting ready for Windows Azure development

Heard about the cloud? Excited about the possibilities? In this session we have a 1000-mile introduction to Microsoft’s operating system for the cloud, Windows Azure, how it compares to the other cloud offerings that are out there and how to get your hands dirty with the skill-up process. Endless possibilities + new tech = fun stuff.
Presenter: Ryno Rijnsburger

An introduction to Mercurial Source Control

Want a quick introduction into a Distributed Version Control System (DVCS)? Meet Mercurial it is a cross-platform, fast, lightweight source control management system designed for easy and efficient handling of distributed projects.
Presenter: Zayd Kara (ATC Team Member)

Making money with Coded UI

Coded UI is a brand new feature of Visual Studio 2010 which enables you to quickly build automated user interface tests for your application and run them as if they were unit tests. In the talk we will look at how Coded UI can change your life, one UI at a time!
Presenter: ME! (ATC Team Member)

Hack .Net in 10 Seconds - Why obfuscation is critical

Hacking 101 – I demonstrate how to bypass basic copy protection in an unobfusctaed .Net application through reverse engineering and show how obfuscation adds a layer of protection. I also demonstrate additional techniques for protecting your applications from hacking once they are released in the wild.
Presenter: Mark Pearl

Composite Applications with PRISM

In this session Stephan will demonstrate how to leverage the Composite Application Libraries to create modularized applications for WPF and Silverlight. He will also show you how to do multi-targeted development by sharing lots of code between the web and desktop applications.
Presenter: Stephan Johnson

An Introduction to Pex and Moles

An introduction into Pex and Moles, covering the basics of Mole Types and Mole Stubs and Parameterised Testing.
Presenter: Dave Russell

ASP.NET Dynamic Data

I will briefly introduce ASP.NET Dynamic Data by showing how to build a complete data maintenance web application with almost zero code.

Moving on, I will demonstrate some standard ways of customising a Dynamic Data application, and some more advanced non-standard customisation techniques. I will finish off by illustrating how Dynamic Data libraries and controls can be leveraged in other applications that don't normally use dynamic data.

Presenter: Brady Kelly


As you probably already surmised, ASP.NET MVC 3 is the next major release of ASP.NET MVC. Join us as we highlight the upcoming features and modifications to this popular framework.
Presenters: Jaco Pretorius and Kobus Brummer

ALM in 2010

Submitted by Robert MacLean on Thu, 07/22/2010 - 08:35

Here is the slides from my talk on Application Lifecycle Management in 2010 which I did for the Information Worker user group.

Here is the blurb for the session

Development is not just about writing code and pressing compile. It is a process, which starts long before code is written and extends long after the compile is done and this process includes a lot of management - this process is called Application Lifecycle Management (ALM).

SharePoint development is not immune to this and this presentation looks at what the landscape and tools are like for ALM in 2010 and how it relates to SharePoint development.

You can download the slides and the white paper from the IW site.

How to create an adapter for the TFS Integration Platform - Appendix 2: SimpleDictionary

Submitted by Robert MacLean on Thu, 06/10/2010 - 12:34

Note: This post is part of a series and you can find the rest of the parts in the series index.

For my WI adapter I needed an implementation of Dictionary<T,V> which could be serialised and unfortunately the .NET one can’t. So I threw together a simple implementation of one using two List<T>. It is not perfect for every possible time you may need an alternative to Dictionary<T,V>, for example the only item manipulation I have is to add an item and clear all items, but it is great for my needs in the case:

public class SimpleDictionary<Key, Value> : IEnumerable, IXmlSerializable
    private List<Key> keys = new List<Key>();
    private List<Value> values = new List<Value>();

    public List<Key> Keys
            return keys;

    public List<Value> Values
            return values;

    public IEnumerator GetEnumerator()
        return (IEnumerator)new SimpleDictionaryEnumerator(this);

    public void Add(Key key, Value value)

    public void Add(object o)
        KeyValuePair<Key, Value>? keyValuePair = o as KeyValuePair<Key, Value>?;
        if (keyValuePair != null)
            this.Add(keyValuePair.Value.Key, keyValuePair.Value.Value);

    public void Clear()


    private class SimpleDictionaryEnumerator : IEnumerator
        private SimpleDictionary<Key, Value> simpleDictionary;
        private int index = -1;

        public SimpleDictionaryEnumerator(SimpleDictionary<Key, Value> simpleDictionary)
            this.simpleDictionary = simpleDictionary;

        #region IEnumerator Members

        public object Current
                return new KeyValuePair<Key, Value>(simpleDictionary.keys[index], simpleDictionary.values[index]);

        public bool MoveNext()
            return !(index >= simpleDictionary.keys.Count);


        public void Reset()
            index = -1;

    public System.Xml.Schema.XmlSchema GetSchema()
        return null;

    public void ReadXml(XmlReader reader)
        if (reader.IsEmptyElement)

        XmlSerializer keySerialiser = new XmlSerializer(typeof(Key));
        XmlSerializer valueSerialiser = new XmlSerializer(typeof(Value));

        while (reader.NodeType != System.Xml.XmlNodeType.EndElement)

            Key key = (Key)keySerialiser.Deserialize(reader);

            Value value = (Value)valueSerialiser.Deserialize(reader);

            this.Add(key, value);

            reader.ReadEndElement(); // for keyvaluepair

        reader.ReadEndElement(); // for root

    public void WriteXml(XmlWriter writer)
        XmlSerializer keySerialiser = new XmlSerializer(typeof(Key));
        XmlSerializer valueSerialiser = new XmlSerializer(typeof(Value));

        for (int counter = 0; counter < this.keys.Count; counter++)

            keySerialiser.Serialize(writer, this.keys[counter]);

            valueSerialiser.Serialize(writer, this.values[counter]);



How to create an adapter for the TFS Integration Platform - Appendix 1: Power Tips

Submitted by Robert MacLean on Wed, 06/09/2010 - 14:38

Note: This post is part of a series and you can find the rest of the parts in the series index.

Throughout the series I have share a bunch of power tips for making this easier and this is a quick cheat sheet of them all.

From Part II: Getting Started

  • Power Tip: Once you have completed the tools install, go into to SQL Server and backup the TFSIntegrationPlatform database immediately. There are not only a few odd bugs that roam around which may cause you to need it but if you want to test on a clean environment, a restore is quicker than a reinstall.
  • Power Tip: Make a common root for the TFS code and yours (in my case I used RangersCode) and then create sub directories in there for platform and your code (so I had My Production and MS production folders under RangersCode). This helps keep the items close, which makes things easier later plus keeps them separate so you can identify them.

From Part III: Overview of adapters

  • Power Tip: The TraceManager puts all information written to it in the log files, so please make sure you do not put any sensitive information in there.

From Part IV: IProvider

From Part V: Items (IMigrationItem & IMigrationItemSerializer)

  • Power Tip: VC stands for Version Control. This refers to an adapter that works with the source control aspects of the system. WI, work items, and WIT, work item tracking, are the same thing. File attachments in WI are NOT regarded as VC and must be handled by your WI adapter.
  • Power Tip: When you are downloading files in the IMigrationItem, you are responsible for the creation of the path too. So make sure you are creating directories and also checking what directories exist too.

From Part VIII: IMigrationProvider

  • Power Tip: In my implementation I used the very useful Path.GetTempFileName() from the .NET framework to get a place to put the file. However this causes an empty temp file to be created automatically and the platform doesn’t like that, so I needed to delete the temp file after that, and then call Download.
  • Power Tip: For folders creation or for deletes of files/folders you can use the Path property of the action to get the folder name.

From Part IX: IServerPathTranslationService

  • Power Tip: The neutral path, or canonical path as it is correctly named, is a path that is “Unix like”, (I.e. /src/project/). However these do not follow all the same rules as true Unix paths. For example : is a valid character in the path.

How to create an adapter for the TFS Integration Platform - Part X: Reflection on SharePoint

Submitted by Robert MacLean on Tue, 06/08/2010 - 16:09

Note: This post is part of a series and you can find the rest of the parts in the series index.

This post is not a technically heavy, like the most of the series, but more a reflection on what I learnt about integrating to SharePoint. This information will hold true for any type of work with SharePoint, not just if you are creating adapters.

What I used

For the WIT adapter I used on the lists.asmx web service, which allows you to work with list items. While with the VC adapter I used both the lists.asmx and copy.asmx web service and I ended up using some WebDav methods too. You may be asking why I needed lists.asmx with VC – because of SharePoint Rule #1 “Everything is a list” – even a document library. The copy web service allows for files to be uploaded to SharePoint.

My goal was to use just web services, which are one of the three ways you can interact with SharePoint the other two being WebDav and the API. The API is better than web services in every aspect (it is faster and more feature complete) but has a serious limitation, you MUST run the application using the API on the same server as SharePoint is install on. It makes it really only useful for tools used by SharePoint admins or web components, like web parts. WebDav is a standard for talking to web services and is generally regarded as a poorer implementation compared to the web services because it does much less.

In the end I had a bug with file deletion in the VC adapter when using the web services. After much fighting, I gave up and used WebDav for that one function.

What I learnt

If I rewrote these adapters I would use mostly WebDav and only use the lists.asmx web service for meta information tasks rather than manipulation. This is because while the WebDav implementation does less, it does all the fundamentals (create, update, delete) and it does it faster and more reliable way than the list and copy web services. The lists.asmx web service would be used only for getting item ID’s, lists of items, files and folders and maybe renaming since WebDav can’t rename. This would allow me to drop the copy web service would give me faster adapters and cleaner code in less time.

How to create an adapter for the TFS Integration Platform - Part IX: IServerPathTranslationService

Submitted by Robert MacLean on Mon, 06/07/2010 - 13:04

Note: This post is part of a series and you can find the rest of the parts in the series index.

IServerPathTranslationService takes the path to your source control item and translates it into a platform neutral path and visa versa. An example for this is if you were moving files between Windows and Linux. On Windows your path may be c:\RangersCode\My Production\ while on Linux that path needs to become/src/RangersCode/My Production/ to handle the differences you need to change it to a neutral path first.

The amount of sleep that I lost on path translation is embarrassing because the concept is dead simple, applying it correctly is ridiculously hard. The de facto guide for how this should work can be found on Willy-Peter’s blog, however there is also an update based on a lot of question asking by me which you may want to read.

This is only needed for VC adapters so if you just want a WI adapter you can skip this.

Power Tip: The neutral path, or canonical path as it is correctly named, is a path that is “Unix like”, (I.e. /src/project/). However these do not follow all the same rules as true Unix paths. For example : is a valid character in the path.

The two methods you need to implement are:


This method requires you provide a neutral path for one of your paths. For me this is simply just putting a leading slash on the item’s URL:

public string TranslateToCanonicalPathCaseSensitive(string serverPath)
    TraceManager.TraceInformation("WSSVC:TranslationToCanonical - {0}", serverPath);
    string localPath = string.Format(CultureInfo.CurrentCulture, "/{0}", serverPath);
    TraceManager.TraceInformation("WSSVC:New:{0} -> {1}", serverPath, localPath);
    return localPath;


This method is the reverse from TranslateToCanonicalPathCaseSensitive it takes a neutral path and provides one that applies to your adapter. In my case it meant dropping the first character and making sure I had an absolute URI:

public string TranslateFromCanonicalPath(string canonicalPath, string canonicalFilterPath)
    TraceManager.TraceInformation("WSSVC:TranslationFromCanonical - {0} - {1}", canonicalPath, canonicalFilterPath);
    string result = new Uri(canonicalPath.Substring(1)).AbsoluteUri;
    TraceManager.TraceInformation("WSSVC:TranslationFromCanonical:Result {0}", result);
    return result;

First in the Platform’s Eyes

There is an interesting thing that the platform does when it comes to server path translation, it creates this class first. This is before anything else, like the configuration service, so you need to make sure this class relies on very little, if any ,outside information. During the creation it also takes the root path from the filter items in your configuration and passes it to TranslateToCanonicalPathCaseSensitive to get the root neutral path. It needs to know this because it will want to strip this information out when it passes it to the other adapter and add it back when other adapters pass their paths to you.

How to create an adapter for the TFS Integration Platform - Part VIII: IMigrationProvider

Submitted by Robert MacLean on Fri, 06/04/2010 - 09:50

Note: This post is part of a series and you can find the rest of the parts in the series index.

The IMigrationProvider interface is the sister to IAnalysisProvider and handles the writing to your system. As with IAnalysisProvider it include some methods you can ignore.


As with IAnalysisProvider the InitializeServices method is what is called first and is used for all setup. In my implementation I do a lot of setup for SharePoint which may not apply to other implementations. One thing you must do though, is register your item serialiser with the platform as follows:

changeGroupService.RegisterDefaultSourceSerilizer(new SharePointVCMigrationItemSerializer());


The ProcessChangeGroup method is the most important method of IMigrationProvider as it is called to do the write operation. You are provided a ChangeGroup and the Actions property of that ChangeGroup contains each file/folder/item you need to write/update/delete to your system. The ProcessChangeGroup needs to return a  log of what has happened so that the platform knows all the actions were performed and also so it can correctly tie up item unique ID’s in your system with the other system unique item ID’s. The log is done with a ConversionResult

ConversionResult conversionResult = new ConversionResult(configurationService.MigrationPeer, configurationService.SourceId);

Each action has an Action which tells you what you need to do with the item, be it an update or add or delete etc…

Each action also has an ItemTypeReferenceName which tells you what it is. For WIT this is not too important as you will be dealing with work items, but for VC this very important as it could be a concrete item file or folder or a more theoretical item like a branch or merge instruction.

So you need to loop over all the actions and based on the action + type do the correct thing:

foreach (MigrationAction action in changeGroup.Actions)
    if (action.Action == WellKnownChangeActionId.Add || action.Action == WellKnownChangeActionId.Edit)
        if (action.ItemTypeReferenceName == WellKnownContentType.VersionControlledFile.ReferenceName)

Once you have completed your action you need to add the information to the conversion result log. My two adapters do this very differently for no reason other than I wrote the VC adapter much earlier and when I write the WI adapter later I did a more refined generic implementation there. The key part of the adding the information though is below. The most important thing is to provide the ID (the third parameter) to the platform so it knows how to link your item in future which is needed for deletes and updates.

conversionResult.ItemConversionHistory.Add(new ItemConversionHistory(sourceSystemId, string.Empty, newSharePointId.ToString(), string.Empty));

Items and VC

With the VC adapter the way you request the actual file you want is using the Download method on the source item and providing a path.

Power Tip: In my implementation I used the very useful Path.GetTempFileName() from the .NET framework to get a place to put the file. However this causes an empty temp file to be created automatically and the platform doesn’t like that, so I needed to delete the temp file after that, and then call Download.

Power Tip: For folders creation or for deletes of files/folders you can use the Path property of the action to get the folder name.

Items and WIT

WIT is easier when it comes to writing because you do not need to worry about paths and files - you just need to do some XML parsing. All the information about the item will be provided to you in the MigrationActionDescription property of the action and you need to parse that into an item. Since the mapping of field names is handled by the platform this is very simple. In my case the following small method was all I needed to build a list of fields:

private static Dictionary<string, object> BuildFieldList(IMigrationAction action)
    Dictionary<string, object> fields = new Dictionary<string, object>();

    XmlNodeList columns = action.MigrationActionDescription.SelectNodes("/WorkItemChanges/Columns/Column");

    foreach (XmlNode columnData in columns)
        string fieldValue = columnData.FirstChild.InnerText;
        string fieldName = columnData.Attributes["ReferenceName"].Value;

        if (string.IsNullOrEmpty(fieldName) == false)
            fields.Add(fieldName, fieldValue);

    return fields;

Item ID

The platform handles the mapping of item ID’s too, so if you need to know what item needs to be updated or deleted it can be found in the MigrationActionDescription. The following method will work regardless of what your system is:

private string GetSharePointID(IMigrationAction action)
    XmlNode workItemChangesNode = action.MigrationActionDescription.SelectSingleNode("/WorkItemChanges");
    string value = string.Empty;

    if (workItemChangesNode.Attributes["TargetWorkItemID"] == null)
        TraceManager.TraceInformation("WSSWIT:MP:GetSharePointID:Cannot find work item id. XML is: {0}", workItemChangesNode.OuterXml);
        value = workItemChangesNode.Attributes["TargetWorkItemID"].Value;
        TraceManager.TraceInformation("WSSWIT:MP:GetSharePointID:Value {0}", value);

    return value;

How to create an adapter for the TFS Integration Platform - Part VII: WIT Conflict Handling

Submitted by Robert MacLean on Thu, 06/03/2010 - 09:40

Note: This post is part of a series and you can find the rest of the parts in the series index.

The WIT adapter needs a custom conflict type and a custom conflict handler, really for no reason other than the platform expects it.

Conflict Handler

If you have no reason for a custom conflict handler, a simple implementation which allows for manual resolution can be created, which is what I have below.

public class SharePointWITGeneralConflictHandler : IConflictHandler
    public bool CanResolve(MigrationConflict conflict, ConflictResolutionRule rule)
        return ConflictTypeHandled.ScopeInterpreter.IsInScope(conflict.ScopeHint, rule.ApplicabilityScope);

    public ConflictResolutionResult Resolve(MigrationConflict conflict, ConflictResolutionRule rule, out List<MigrationAction> actions)
        actions = null;

        if (rule.ActionRefNameGuid.Equals(new ManualConflictResolutionAction().ReferenceName))
            return ManualResolve(out actions);

        return new ConflictResolutionResult(false, ConflictResolutionType.Other);

    public ConflictType ConflictTypeHandled

    private static ConflictResolutionResult ManualResolve(out List<MigrationAction> actions)
        actions = null;
        return new ConflictResolutionResult(true, ConflictResolutionType.Other);

Conflict Type

If you have no reason for a custom conflict type, you can do what I did which is to re-implement the generic one with even less features namely only supporting ManualConflictResolution and a very simple scope hint.

public class SharePointWITGeneralConflictType : ConflictType
    public static MigrationConflict CreateConflict(Exception exception)
        return new MigrationConflict(
            new SharePointWITGeneralConflictType(),

    public static MigrationConflict CreateConflict(Exception exception, IMigrationAction conflictedAction)
        return new SharePointWITGeneralConflictType().CreateConflict(exception.ToString(), CreateScopeHint(Guid.NewGuid().ToString()), conflictedAction);

    public override Guid ReferenceName
            return s_conflictTypeReferenceName;

    public override string FriendlyName
            return s_conflictTypeFriendlyName;

    public override string Description
            return s_conflictTypeDescription;

    public SharePointWITGeneralConflictType()
        : base(new SharePointWITGeneralConflictHandler())
    { }

    public static string CreateScopeHint(string sourceItemId)
        return string.Format(CultureInfo.CurrentCulture, "/{0}/{1}", sourceItemId, Guid.NewGuid().ToString());

    protected override void RegisterDefaultSupportedResolutionActions()
        AddSupportedResolutionAction(new ManualConflictResolutionAction());

    private static readonly Guid s_conflictTypeReferenceName = new Guid("{606531DF-231A-496B-9996-50F239481988}");
    private const string s_conflictTypeFriendlyName = "TFS WIT general conflict type";
    private const string s_conflictTypeDescription =
        "This conflict is detected when an unknown exception is thrown during Work Item data submission.";

How to create an adapter for the TFS Integration Platform - Part VI: IAnalysisProvider

Submitted by Robert MacLean on Wed, 06/02/2010 - 16:22

Note: This post is part of a series and you can find the rest of the parts in the series index.

IAnalysisProvider, has a name that is a bit misleading, or was misleading to me because for a long time I thought it did some analysis of the environment as a pre-step and then real work happened elsewhere. The reality is the IAnalysisProvider is the reader part of your adapter, it’s goal is to get data from your system and into a format and/or location that the platform can work with.



IAnalysisProvider inherits from IServiceProvider which means you need to implement a method for that, GetService, which just returns this object.

object IServiceProvider.GetService(Type serviceType)
    return (IServiceProvider)this;

Misc Methods

I am not cover every method you need to implement from IAnalysisProvider, because you seldom need to implement them all. For example in my implementation of DetectConflicts is just does some logging:

void IAnalysisProvider.DetectConflicts(ChangeGroup changeGroup)


The first method you must care about is InitializeServices, this is the first method which is called by the platform and it does five key things in my scenario:

void IAnalysisProvider.InitializeServices(IServiceContainer serviceContainer)
    this.analysisServiceContainer = serviceContainer;

    supportedContentTypes = new Collection<ContentType>();

    SharePointVCChangeActionHandler handler = new SharePointVCChangeActionHandler(this);
    supportedChangeActions = new Dictionary<Guid, ChangeActionHandler>();
    supportedChangeActions.Add(WellKnownChangeActionId.Add, handler.BasicActionHandler);
    supportedChangeActions.Add(WellKnownChangeActionId.Delete, handler.BasicActionHandler);
    supportedChangeActions.Add(WellKnownChangeActionId.Edit, handler.BasicActionHandler);

    configurationService = (ConfigurationService)analysisServiceContainer.GetService(typeof(ConfigurationService));

    highWaterMarkDelta = new HighWaterMark<DateTime>(Constants.HwmDelta);
    highWaterMarkChangeset = new HighWaterMark<int>("LastChangeSet");
    changeGroupService = (ChangeGroupService)analysisServiceContainer.GetService(typeof(ChangeGroupService));
    changeGroupService.RegisterDefaultSourceSerilizer(new SharePointVCMigrationItemSerializer());
  • The first part is the setting up of what types of content we support (lines 6 to lines 8). You can see above I only care about files and folders.
  • The second part is the setting up of what actions we support for reading (lines 10 to 14), which in this case is Add, Delete and Edit. Delete is a bit of a lie since we do not actually support it but we say we do.
  • The third part is getting the configuration service which is important since we will use it later (line 16).
  • The forth part is getting the HWM, or high watermark information (lines 18 to 21) which I will explain in a moment.
  • Lastly we register the default item serialiser (line 23) so that the platform knows how to convert the items.


We setup the content types and actions we support and then we need to register those and the way to do that is with RegisterSupportedChangeActions. What I did was to loop over the actions and then loop over the types finally calling RegisterChangeAction. You could do this differently, for example if you only supported some actions on some types:

void IAnalysisProvider.RegisterSupportedChangeActions(ChangeActionRegistrationService contentActionRegistrationService)
    this.changeActionRegistrationService = contentActionRegistrationService;
    foreach (KeyValuePair<Guid, ChangeActionHandler> supportedChangeAction in supportedChangeActions)
        foreach (ContentType contentType in ((IAnalysisProvider)this).SupportedContentTypes)
            changeActionRegistrationService.RegisterChangeAction(supportedChangeAction.Key, contentType.ReferenceName, supportedChangeAction.Value);


The ChangeActionHandler class is a separate class which is used in the IAnalysisProvider during registration which provides the minimal functionality for figuring out how to register a new action (i.e. add file, update work item etc…).

public abstract class ChangeActionHandlers
    protected ChangeActionHandlers(IAnalysisProvider analysisProvider)

    public virtual void BasicActionHandler(MigrationAction action, ChangeGroup group)
        if (action == null)
            throw new ArgumentNullException("action");

        if (group == null)
            throw new ArgumentNullException("group");

            action.Path, action.Version,

High Watermark

High watermarks are a very interesting feature of the platform, and they let you store a value in the database for the usage of identification of change groups. One aspect I liked of it’s construction is its use of generics, meaning you can work with the types that make the most sense, so I have Int and DateTime, and as you associate a name to it.

To get the value from the database you called the Reload method, to set the value and save call Update.


Conflict Types

I have mentioned conflict types briefly before and I have said that my VC adapter does not have a conflict type which is not 100% true. It does have one, the GenericConflictType, which is base from the platform. Below is the code snippet from the WIT adapter which does have a custom conflict type. The only difference with the VC adapter is that last line does not exist.

public void RegisterConflictTypes(ConflictManager conflictManager)
    this.conflictManagerService = (ConflictManager)analysisServiceContainer.GetService(typeof(ConflictManager));
    this.conflictManagerService.RegisterConflictType(new GenericConflictType());
    this.conflictManagerService.RegisterConflictType(new SharePointWITGeneralConflictType(), SyncOrchestrator.ConflictsSyncOrchOptions.Continue);


The next method to cover, and the second most important is GenerateDeltaTable which is responsible for actually getting the values from the source system. This is done below in two steps first GetSharePointUpdates and second PromoteDeltaToPending.

void IAnalysisProvider.GenerateDeltaTable()
    TraceManager.TraceInformation("\tWSSVC:AP:Initial HighWaterMark {0} ", highWaterMarkDelta.Value);
    deltaTableStartTime = DateTime.Now;
    TraceManager.TraceInformation("\tWSSVC:AP:CutOff {0} ", deltaTableStartTime);
    TraceManager.TraceInformation("\tWSSVC:AP:Updated HighWaterMark {0} ", highWaterMarkDelta.Value);


This is a huge method and does the heavily lifting and I will skip covering all the boring details of talking to SharePoint and focus covering what you need to do. First you need to identify what is new, this is done using the HWM and comparing the modified date.

// item has been modified since HWM & before deltra table start time
if (item.Modified.CompareTo(highWaterMarkDelta.Value) > 0 && item.Modified.CompareTo(deltaTableStartTime) < 0) 

You also need to figure out if the file is new or an update. In my VC adapter I created a special system called the ProcessLog. This was to cater with a situation caused by SharePoint and won’t apply to other systems. Once you done all of that you can tell the platform about it by creating an action and saving the action. The following code is for VC:

TraceManager.TraceInformation("\tChangeSet:{0} - {1} ({2})", highWaterMarkChangeset.Value, item.Filename, item.AbsoluteURL);
string itemType = item.ItemType.ToWellKnownContentType().ReferenceName;
ChangeGroup cg = CreateChangeGroup(highWaterMarkChangeset.Value, 0);
cg.CreateAction(actionGuid, item, null, item.AbsoluteURL, item.Version, null, itemType, null);
highWaterMarkChangeset.Update(highWaterMarkChangeset.Value + 1);

and this is the same logic for WIT:

ChangeGroup changeGroup = CreateChangeGroup(highWaterMarkChangeSet.Value, 0);
changeGroup.CreateAction(actionGuid, task, string.Empty, listName, string.Empty, string.Empty,
    WellKnownContentType.WorkItem.ReferenceName, CreateFieldRevisionDescriptionDoc(task));
highWaterMarkChangeSet.Update(highWaterMarkChangeSet.Value + 1);

Revision Description Doc

While the VC adapter is fairly easy, the downloading is done in the SharePointItem - the WIT adapter doesn’t download anything. What it needs is a special XML file called a revision description document. You are responsible for the generation of this document as part of the creation of the action (you may have noticed that in the sample above).

This is what actually makes the field mapping possible, if you do not understand field mapping you must read Willy-Peter’s post on it. You can see below how I create my document, which is created per SharePoint list item and how I can support all the columns, including custom ones:

private static XmlDocument CreateFieldRevisionDescriptionDoc(SharePointListItem task)
    XElement columns = new XElement("Columns",
            new XElement("Column",
                new XAttribute("DisplayName", "Author"),
                new XAttribute("ReferenceName", "Author"),
                new XAttribute("Type", "String"),
                new XElement("Value", task.AuthorId)),
            new XElement("Column",
                new XAttribute("DisplayName", "DisplayName"),
                new XAttribute("ReferenceName", "DisplayName"),
                new XAttribute("Type", "String"),
                new XElement("Value", task.DisplayName)),
            new XElement("Column",
                new XAttribute("DisplayName", "Id"),
                new XAttribute("ReferenceName", "Id"),
                new XAttribute("Type", "String"),
                new XElement("Value", task.Id.ToString())));

    foreach (KeyValuePair<string, object> column in task.Columns)
        columns.Add(new XElement("Column",
            new XAttribute("DisplayName", column.Key),
                new XAttribute("ReferenceName", column.Key),
                new XAttribute("Type", "String"),
                new XElement("Value", column.Value)));

    XElement descriptionDoc = new XElement("WorkItemChanges",
        new XAttribute("Revision", "0"),
        new XAttribute("WorkItemType", "SharePointItem"),
        new XAttribute("Author", task.AuthorId),
        new XAttribute("ChangeDate", task.ModifiedOn.ToString(CultureInfo.CurrentCulture)),
        new XAttribute("WorkItemID", task.Id.ToString()),

    XmlDocument doc = new XmlDocument();
    return doc;