Integrating SharePoint and Umbraco

Umbraco is a really cool open source CMS released under MIT license. And with more than 85000 active installations I must say it’s a very impressing piece of work. Microsoft Office SharePoint Server (MOSS) and Windows SharePoint Services (WSS) is quickly becoming a dominate application for storing and maintaining enterprise data and intelligence for organizations of all sizes.

But, they don’t do together. There are a few ways of integrating and interfacing towards SharePoint but each and one of them requires you to either spend a lot of time understanding the MOSS/WSS data structure, naming conventions and data type conversion requirements. The developer also needs to understand the CAML (Collaborative Application Markup Language) syntax used to query lists and views. The code base tends to grow to a size that is not in proportion to the functionality.

This is a problem we used to have as well.

Watch the webcast in how to make a simple integration between SharePoint and Umbraco

In this demo we simply pull the data from a SharePoint list to a specific Umbraco template. The data is pulled every time some one requests the page.


Setting up SharePoint

  1. Create a list called something like “SharePoint Articles”
  2. Create two extra columns, Article and Publish to external
    1. Article: Use “Multiple lines of text” and uncheck the “Add to default view”
    2. Publish to external: Use “Yes/No (check box)”, make sure the “Add to default view” is checked
  3. Create some articles

When you are done it should look something like this

Building the Umbraco macro

Create a standard ASP.NET Web Application in Visual Studio 2010, throw away everything except the project file and create a “New Item” > “Web User Control”. I named mine to UmbracoCamelotDemo.


This is the file that renders the content to Umbraco. You should have one line in it, the <%@ Control. We must add an asp:Panel to display our data.

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="UmbracoCamelotDemo.ascx.vb" Inherits="UmbracoCamelotDemo.WebUserControl1" %>
<asp:Panel ID="Panel1" runat="server"></asp:Panel>


The code behind file …

Public Class WebUserControl1
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim connectionString As String = "Server=yourserver;Database=;Domain=;User=sharepointuser;"_ "Password=sharepointpassword;Authentication=Ntml;TimeOut=10;strictmode=false;recursivemode=recursiveall;"_ "defaultlimit=1000;cachetimeout=5;MaxReceivedMessageSize=10000000;MaxBytesPerRead=10000000"
        Dim conn As New Camelot.SharePointConnector.Data.SharePointConnection(connectionString)

        Dim query As String = "SELECT ID, Title, Article FROM `SharePoint articles`.all WHERE `Publish to external` = 1"
        Dim adapter As New Camelot.SharePointConnector.Data.SharePointDataAdapter(query, conn)

        Dim dtMyWebPartList As New DataTable()

        For Each row As DataRow In dtMyWebPartList.Rows
            Dim c As New System.Web.UI.WebControls.Label
            c.Text = "<h2>" + row.Item("Title").ToString + "</h2>"
            c.Text += row.Item("Article").ToString

    End Sub

End Class

Build, deploy and show

Simply build the files and deploy them in Umbraco

  • Put UmbracoCamelotDemo.ascx in the /usercontrols directory in the Umbraco web root
  • Put the UmbracoCamelotDemo.ascx.vb file in the /bin directory in the Umbraco web root.

Add the macro in the Umbraco admin interface

  1. Navigate to the Developer section
  2. Right click Macros and select create
  3. Type CamelotDemo as name (Or what ever suits you best, this can be changed afterwards)
  4. Use the list “Browse usercontrols on server…” and select your usercontrol there.
  5. Save

Navigate to the settings section and create a new template, or modify an existing. This example creates a new template

  1. Right click the Master page and select Create
  2. Add any elements you prefer here and the macro, I’ve posted my page code below. To add a macro click the macro button and select your macro
  3. Save

<%@ Master Language="C#" MasterPageFile="~/masterpages/RunwayMaster.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="RunwayMasterContentPlaceHolder" runat="server">
  <div id="content">
    <umbraco:Item runat="server" field="bodyText" />
    <umbraco:Macro Alias="CamelotDemo" runat="server"></umbraco:Macro>

You must also add the new template to a document type

  1. Expand the document types and select the document type you want to link i to (or allow it from)
  2. Save

Create the page SharePoint Articles

  1. Navigate to the content section
  2. Create a new page, name it and select the document type you linked your template to
  3. Enter some body text if you like and go to the properties tab
  4. Select the template you created
  5. Save and publish

Thats it!

You should now have a live view of your articles stored in SharePoint in Umbraco

Thanks for reading, please leave a comment or contact us at

This entry was posted in SharePoint. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>