Navigation

Showing posts with label Events. Show all posts
Showing posts with label Events. Show all posts

Monday, 30 September 2013

I'm Speaking at SharePoint Saturday UK 2013

I am honoured to have been invited back as one of the speakers of SharePoint Saturday UK.

This is a FREE annual event (so far held in the UK midlands) towards the end of the year and always includes a tonne of awesome content for developers, IT Pros and power users, and this year is no exception.

This year it will be held at the Hinckley Island Hotel, Hinckley, Leicestershire on the 9th November. As usual there are loads of great sessions and some really excellent seasoned speakers of international fame.

I'm will be speaking in the DEV track about Developing custom templates for the Content Search Web Part in SharePoint 2013, but definitely check out the full schedule and speaker list.

The event is always concluded with a SharePint and a good night out so if you are UK based (or fancy travelling over for the day) make sure you register for the event and hopefully I'll see you there!

If you are avid on twitter then be sure to keep an eye on the #SPSUK hashtag for all the latest event updates.

Monday, 14 November 2011

Summary of SharePoint Saturday UK 2011

Well, this was actually my first SharePoint Saturday experience and I have to say I was massively impressed! The whole day was very well organised and felt like other SharePoint conferences I have been to in the past (with a great variety of the sessions available and excellent quality and depth of the content being presented).

I actually brought a friend with me to SPSUK and he is mostly looking at Office 365 and Windows Phone technologies so that ended up being one of my main focuses as well. I also spent some time prepping (and packing away) from my session, as well as some time in the "Ask the Experts" room (where I met @MossLover and @SharePointBuzz for the first time :)) so I didn't get round to as many sessions as I would have otherwise liked.

Configuring Kerberos in a SharePoint 2010 Farm (#SPSUK06)
I was up first presenting this session and I was very pleased with how it went. We had a great turnout, some really good questions and (to my relief) all of the demos worked really well first time! :) This was a re-run of my SUGUK session in August on the same subject and I'm quite pleased with how the session shaped up.

It was very nice getting people coming up to me during the breaks, in the Ask the Experts session or even on twitter and email afterwards (asking questions, or just telling me how much they enjoyed the session) .. these kind of touch points really make the whole thing worth while :)

If you are looking for my slide decks then you can find them here:
They are branded for SUGUK but the content is the same so you should find everything you need :)


  • Download PowerPoint Slide Deck (PPTX) (zip)
  • View online using PowerPoint Web App

  • (PS - The PowerPoint Web App is powered by Office 365, so hope it works well for you. Feedback welcome!)

    Extending SharePoint 2010 LOB Apps to Windows Phone 7 (#SPSUK23)
    This was a good presentation by Chris Forbes (@chris_e_forbes) on Windows Phone 7 development and SharePoint 2010 integration. This is an area I am getting very interested in for two major reasons:
    1. Office 365 now supports BCS in SharePoint Online, so you can write "no-code" methods of calling WCF web services (which potentially allows the Windows Phone 7 "push notification" services which Microsoft host)
    2. The new "Mango" (Windows Phone 7.5) release includes back-ground tasks, which may allow a background application to respond to push notifications and execute custom code.
    This really opens up the doors in terms of having a very powerful zero-infrastructure solution leveraging both Office 365 and Windows Phone 7!

    Sort your processes with easy, effective InfoPath Forms and SharePoint Workflows (#SPSUK15)
    My final session of the day was with Ian Woodgate (@ianwoodgate) and ran through some cool InfoPath techniques (easy cascading drop-downs) and especially the InfoPath "Approval" mechanism which is being championed by Laura Rogers (@WonderLaura).

    Everytime I look at InfoPath I get more and more impressed, and with Office 365 it really does open up a lot of doors in terms of process automation, workflow and external communications without having to write any custom code (which is ideal when, in SharePoint Online, your development is limited to the SharePoint 2010 Sandbox which restricts a lot of methods).

    Steve Fox - “SharePoint and the Cloud: Crash or Convergence?”
    The end of the day was spent with Steve Fox (@redmondhockey) from Microsoft giving us some live demos of the new Windows Azure platform and some SharePoint 2010 integration (both on-premise and using SharePoint Online) as well as Windows Phone 7.

    Wrap Up
    This was a really good day. I was quite surprised at the number of people there (for a free event, all day on a Saturday) and everyone had a very relaxed non-commercial attitude to the day which was refreshing for a "conference" type event.

    I will definately be going to the next one .. and I seriously recommend that you do too!

    To sum up the day I'll quote from my friend (@Denyerec)

    Back from , or by its other name . Very worthwhile day out.


    Friday, 4 March 2011

    Attending SPRetreat #2 :)

    Well, I snuck in last minute, but I'm managed to book myself a place at the March 2011 SPRetreat London session (Saturday March 5th).


    This is the second SPRetreat, and once again joins Andrew Woodward (@AndrewWoody) as the expert in Unit Testing, Test Driven Development and usage of TypeMock Isolator with SharePoint development techniques.

    http://spretreatlondon11.eventbrite.com/

    Big thanks to:
     
    Wes Hackett for organising and Content and Code for sponsoring the venue.
     
    Typemock for providing a great product (Isolator) and for donating 2 full licenses as prizes worth almost £1,000
     
    21apps for organising and providing the food.
     
    Really looking forward to this :)


    Friday, 15 October 2010

    SUGUK London, 14th October Sandbox Development and jQuery

    Well it was a great night last night. We had a really good turn out (around the 90 mark I think in the end) and it was a cracking dev-focused session.

    Firstly, hats off to Jaap Vossers (@jvossers / blog.vossers.com) who stepped up for his first community event and gave a really good presentation on jQuery and SharePoint.

    My personal favourites were the Developer Dashboard Visualiser (which created a graphical time-line of how long each page component took to load, which you could drill-into) and the Site Settings snap-in (which allowed you to drop in the "Site Settings" page for the current site by pressing Ctrl-S from any page!). Lots of content in there, including using Web Services and utilising some of the Client Object Model.

    Finally Jaap ran a prize draw giving away 5 free copies of a jQuery development book! Good stuff!

    My turn came next, presenting on SharePoint 2010 Sandbox Development. For those of you who follow me on Twitter (@MartinHatch) you will know that I accidentally deleted my virtual machines last week so had to rebuild my farm and re-code all my examples.

    Well .. not one to try making things easier for myself I decided to code all of them from scratch (Sandbox Web Part, Full Trust Proxy and a Solution Validator).

    The only one which didn't work was the Full Trust Proxy (I then found out I had a note in my slide deck on the "demo" slide which read - "make sure you re-start the Sandbox Service after you install the full-trust proxy" .. I have updated my slide deck now to include that VERY important line!) but overall I think it went very well and muchos thanks to all the feedback on Twitter (make sure you use the #SUGUK hashtag!)

    My own slide decks and code samples can all be found on my Sky Drive account here:
    http://cid-60f12a60288e5607.skydrive.live.com/redir.aspx?resid=60F12A60288E5607!621

    Finally we had an impromtu "Ask the Experts Session" .. with the awesome team of Eric Shupps, Chris O'Brien, Andrew Woodward, Steve Smith, Jaap Vossers and myself!

    The evening ended up with a SharePint (although I had to head off to get the last train out into the sussex wilderness I call home!).

    If you were there .. hope you enjoyed it (all feedback welcome!). If not ... I hope to see you at the next SUGUK meeting! :)

    Friday, 17 September 2010

    Presenting at SUGUK London - October 14th

    Yep, the next SharePoint User Group UK (SUGUK) London session has been announced, and I'm going to be presenting on Sandbox Development. (yay!)

    The event is on October 14th 2010 at at Mostyn Hotel (Marble Arch, Bryanston Street, London, W1H 7BY) and the evening starts at 18:00.

    I have the second slot and will be talking about Sandbox Development, a subject which I've been keenly interested in what with Content and Code's products and the expectation of SharePoint 2010 suposedly coming to BPOS (Microsoft's cloud services).
    "This development focused session will walk through the new SharePoint 2010 Sandbox Solutions framework, including the architecture, configuration and development of Sandboxed solutions. Although covering off a few administrative functions do not be fooled .. we will be opening Visual Studio 2010, stepping through code and debugging processes!"
    The session kicks off with Jaap Vossers talking about SharePoint and JQuery. I've been working with Jaap for several months now and some of the JQuery stuff he's done is fantastic, so this is well worth coming along for that session alone!
    "This session will cover everything you need to know about harnessing the power of jQuery in your SharePoint sites. The introduction will look at getting started, the syntax and the plugins before we look at jQuery in a SharePoint context; the benefits, examples, calling web services, loading scripts and deployment. We will then cover the various frameworks and utilities (SPServices, jQueryLoader) before rounding off with a look at further integration opportunities in SP2010 and specifically the Client OM and REST. This is a technical session."
    If you want to register then please sign up at the SUGUK Forum Post (http://suguk.org/forums/thread/25091.aspx).

    I'm really looking forward to it, so please come along, and hopefully I'll see you there!

    Monday, 12 July 2010

    RCWP Part 3 - Edit Web Part using a Ribbon modal dialog

    Also check out the other part of the series:
    This follows on from Part 1 (where we created a “Related Content Web Part”) and Part 2 (where we added a contextual tab to the Ribbon).

    This post summarised the final part of this Web Part (which we completed in the final session of the day of SPRetreat last Saturday).
    We wanted to provide a pop-up window, accessed through our new Contextual Tab in the Ribbon, which allowed us to easily modify some web part properties.
    The basis of this was quite straight-forward, and it certainly starts off quite easy.
    We created a new Application Page (RCWP_SetFieldValue.aspx) which would contain the code to update our Web Part Properties.

    In this file we added a simple ASP.Net Label, Drop Down List and button.
    <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <p>
        This allows you to set the field value for the <strong>Related Content Web Part</strong>
    </p>
    <asp:Label runat="server" ID="lblChoice" Text="Select Field:" AssociatedControlID="ddlFields" /><br />
    <asp:DropDownList runat="server" ID="ddlFields" /><br />
    <asp:Button runat="server" ID="btnNike" Text="Just Do It!" />
    </asp:Content>
    Back in Part 2 we created a JavaScript file which was use for the “Command” events for our Buttons (yes .. I told you we’d be looking at that again!).

    Here we are going to modify one of the Buttons so that it throws up a SharePoint Modal Dialog with our Application Page in it.

    The code below is modified from the original MS Blog Article I referenced in Part 2 (called “How to create a Web Part with a Contextual Tab”).
    if (commandId === 'CustomContextualTab.GoodbyeWorldCommand') {
                //alert('Good-bye, world!');
                var options = {
                    url: '/_layouts/SPR3/RCWP_SetFieldValue.aspx,
                    title: 'Set Field',
                    allowMaximize: false,
                    showClose: true,
                    width: 800,
                    height: 600
                };
                SP.UI.ModalDialog.showModalDialog(options);
            }
    I have basically changed the JavaScript for the “GoodbyeWorldCommand” button so that it does something different.

    I am using the new SP.UI.ModalDialog namespace in the SharePoint ECMAScript to pop up a modal dialog window.

    (Note - I also changed the display text to “Set Field” .. and deleted the other button to clean up the ribbon a bit)

    But don’t forget that our Application Page is running from _layouts … it’s in a completely different place to our Web Part so this really isn’t enough for our page to work. In order to do anything else our Layouts page would need the following information:
    • The Page that the web part is on (URL)
    • Which Web Part to update on that page (Web Part ID)
    The URL of the current page is easy enough using JavaScript (location.href) but the Web Part ID … this represented a new challenge.
    How do you get the server-side Web Part ID through JavaScript?
    This problem took the entire final hour of the day (Session 5) and took quite a bit of research and web searching. Eventually (after a few suggestions) we hit upon the answer:

    Back in Part 2 we created a JavaScript file which was used to register our Contextual Tab. The JavaScript file that registers the Contextual Tab contains a reference to a “PageComponentId”.
    getId: function ContextualTabWebPart_CustomPageComponent$getId() {
        return this._webPartPageComponentId;
    }
    Thes pecific instance of our Web Part had a “PageComponentID” of “WebPartWPQ2” and after some digging we found it in the Source of the page!
    <div WebPartID="866ef42d-6626-45e0-af9c-a00467ed2666" WebPartID2="1ad9529a-5e86-4e7c-9d4d-022a1fa6e6c0" HasPers="false" id="WebPartWPQ2" width="100%" class="ms-WPBody noindex ms-wpContentDivSpace" allowRemove="false" allowDelete="false" style="" >
    The attribute that REALLY stands out though is the WebPartID:
    WebPartID="866ef42d-6626-45e0-af9c-a00467ed2666"
    This is clearly a GUID value, referring to the server-side Web Part ID for that instance of the Web Part.
    So .. how do we get this to our dialog.. well, good old trusty document.GetElementById() (we could have used JQuery, but I didn’t want to have to install the framework .. and don’t forget .. I only had 1 hour to get this working at SPRetreat!!)

    Using this information, I could modify my JavaScript to retrieve these values, and pass them through to my Modal Dialog.
    // get the Web Part DIV element
                var element = document.getElementById(this._webPartPageComponentId);
                // extract the Web Part ID (as a GUID object)
                var wpID = element.attributes["WebPartId"];
                // pass through the URL and Web Part ID
                var options = {
                    url: '/_layouts/SPR3/RCWP_SetFieldValue.aspx?wpID=' + wpID.nodeValue + '&url=' + location.href,
                    title: 'Set Field',
                    allowMaximize: false,
                    showClose: true,
                    width: 800,
                    height: 600
                };
                SP.UI.ModalDialog.showModalDialog(options);
    Note – as the Web Part ID is of type HTML Attribute, we need to use the “NodeValue” property instead of toString();

    So .. first off, in our Application Page we can use the URL to retrieve the fields from the page’s Content Type and populate our Drop Down List.
    protected void Page_Load(object sender, EventArgs e)
            {
                TargetUrl = Request.QueryString["url"];
                // remove any query strings
                if (TargetUrl.IndexOf("?") != -1)
                {
                    TargetUrl = TargetUrl.Substring(0, TargetUrl.IndexOf("?"));
                }
                if (!Page.IsPostBack)
                {
                    ddlFields.Items.Clear();
                    SPFile file = this.Web.GetFile(TargetUrl);
                    foreach (SPField field in file.Item.Fields)
                    {
                        if (!field.Hidden)
                        {
                            ListItem item = new ListItem(field.Title, field.StaticName);
                            ddlFields.Items.Add(item);
                        }
                    }
                }
                btnNike.Click += new EventHandler(btnNike_Click);
            }
    I did a bit of string manipulation on the URL to make sure we trim out any URL query strings, and then use that to retrieve an SPFile object.

    We then just iterate through the SPListItem.Fields collection, adding any fields that are not hidden.

    Note – we are using an ASP.Net ListItem object in the Drop Down List, so that we can use the Display Name in the drop-down, but store the Static Name as the value .. it’s the Static Name we need to save to our Web Part!

    The next bit is under our Click event. We can now use the URL to get the SPLimitedWebPartManager for the page, and pass through the Web Part ID property, and it would retrieve the instance of my Web Part (allowing me to set the field value).
    protected void btnNike_Click(object sender, EventArgs e)
           {
               // get Web Part ID
               wpID = Request.QueryString["wpID"];
               // retrieve the Web Part Panager for the URL
               SPFile file = this.Web.GetFile(TargetUrl);
               SPLimitedWebPartManager wpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
               // get the safely-casted web part object
               RelatedContentWebPart.RelatedContentWebPart wp =
                   wpm.WebParts[new Guid(wpID)] as RelatedContentWebPart.RelatedContentWebPart;
               if (wp != null)
               {
                   // set the web part property, and save settings
                   wp.FieldName = ddlFields.SelectedValue;
                   wpm.SaveChanges(wp);
               }
               // close the modal dialog
               this.Context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>");
               this.Context.Response.End();
           }
    So .. we should be done…

    Build / Deploy / Test




    So .. a long journey but worth it, five different 1 hour sessions and a great day at #SPRetreat .. but definitely worthwhile, and a new “Related Content Web Part” to boot!

    A massive thanks to Andrew Woodward (21Apps) and Ben Robb (CScape) for organising the event, the venue and the food! (great food!!!)

    Source Code

    Sorry it took so long for me to get it all online, I was very busy then went on holiday. You can find all of the source code downloadable from my SkyDrive here:

    http://cid-60f12a60288e5607.office.live.com/self.aspx/SPRetreat/SPR3.zip

    RCWP Part 2 - Web Part with Ribbon Contextual-Tab

    Also check out the other part of the series:
    This follows on from Part 1, where we created a “Related Content Web Part” (RCWP) which would dynamically return search results based on the value of a field on the current page.

    This post summarises the second-phase of that Web Part (which we started in session 4 of SPRetreat) to provide an easier method for the Content Editors to cherry-pick which field they wanted to use for the keyword search value. Seeing as me and my session 4 partner hadn’t done anything with Contextual Tabs before, we decided to give that a crack.

    I’m not going to cover every single details of this. There are 2 fantastic articles:
    Chris O’Brien (MVP) has a great 4-Part series titled “SharePoint 2010 Ribbon Customisation series” which is a must-read if you want to understand more about Ribbon development work.

    There is also an excellent step-by-step guide on the Microsoft SharePoint Developer Documentation Blog called “How to create a Web Part with a contextual tab”.

    In my example, I used the Microsoft blog’s example code, but there are plenty of good tutorials for this on the web. I’m not going to copy the same information in the blog article here, but the summarised core points are as follows:
    • Your Web Part must implement the Interface IWebPartPageComponentProvider(Microsoft.SharePoint.WebControls).
    • The Interface involves a WebPartContextualInfo property, which you use to register you “contextual” event
    • You will need a JS file to stored your “actions”
    • You will need XML configuration to register the definition of your “tab” and it’s controls.
    So first off, we need to modify our web part to implement the Interface IWebPartPageComponentProvider:
    public class RelatedContentWebPart : CoreResultsWebPart,
        IWebPartPageComponentProvider
    {
        // omitted for clarity
    }
    Now, before we implement the Interface we need to setup a few methods and properties.
    First up is the XML schema for both the Tab Template and the Tab itself. It’s a lot of XML so I’m not going to post it here, but I basically copied the XML provided on the MS Blog post, so you should find it easy enough to go and fetch it from there or just use my Full Source Code (in Part 3).

    A snippet of the first part is below;
    private string contextualTab = @"
       <ContextualGroup Color=""Magenta""
         Command=""CustomContextualTab.EnableContextualGroup""
         Id=""Ribbon.CustomContextualTabGroup""
         Title=""Related Content Web Part""
         Sequence=""502""
         ContextualGroupId=""CustomContextualTabGroup"">
              <Tab
                  Id=""Ribbon.CustomTabExample""
                  Title=""Filtering Settings""
                  Description=""This holds my custom commands!""
    // remainder omitted for clarity
    You can see that we have created a string called “contextualTab” that references a “ContextualGroup”. This has a colour, as well as a unique ID that we need to create. The Title will appear in the ribbon as the “contextual” group, which will span across multiple tabs (if you have multiple tabs in the same “contextual group” of course!).

    Note - I have changed the title and description of my Tab and the Contextual Group, but everything else is the same as the MS Blog!

    We also have a standard Ribbon “Tab” declaration, with an Id value which we will need later) as well as the Tab Title and Description.

    Further down in the XML is a reference to the "Buttons” that we are going to have on our tab.
    (Note – the code below is an exact copy of the "MS Blog Article” code .. we will be changing this later on!)
    <Button     Id=""Ribbon.CustomTabExample.
        CustomGroupExample.GoodbyeWorld""
        Command=""CustomContextualTab.GoodbyeWorldCommand""
        Sequence=""15""
        Description=""Show the Goodbye World text""
        LabelText=""Goodbye World!""
        TemplateAlias=""cust1""/>
    Make a note of where these button controls are, because we’re going to need to modify this in Part 3 of this post!

    There is also another string created called “contextualTabTemplate” which you can use for the layout configuration.
    private string contextualTabTemplate = @"
              <GroupTemplate Id=""Ribbon.Templates.CustomTemplateExample"">
                <Layout
                  Title=""OneLargeTwoMedium"" LayoutTitle=""OneLargeTwoMedium"">
                  <Section Alignment=""Top"" Type=""OneRow"">
                    <Row>
                      <ControlRef DisplayMode=""Large"" TemplateAlias=""cust1"" />
                    </Row>
                  </Section>
    // remainder omitted for clarity
    So … now we have all of our XML defined we need to create a JavaScript file. The MS Blog article includes a JS file called “CustomContextualTabPageComponent.js” which deploys directly to the 14\Template\Layouts\ folder.
    This contains a whole load of JavaScript for the Tab, Group and Button items in your XML file.

    Important Note – The Command and Enable scripts use in your XML are in this JS file. If you start changing names you will need to manually keep these files in check.. they are XML and JS files so no compile errors or warnings! … except this one ;)

    Probably the most important section in this file is that which handles the “Command” event for your buttons:
    handleCommand: function ContextualTabWebPart_CustomPageComponent
        $handleCommand(commandId, properties, sequence)
    {
        if (commandId ===
            'CustomContextualTab.HelloWorldCommand) {
                alert('Hello, world!');
        }
        if (commandId ===
            'CustomContextualTab.GoodbyeWorldCommand') {
                alert('Good-bye, world!');
        }
    }
    Again, this code has been copied from the MS Blog, but keep a note of it .. we will be modifying this too in Part 3!

    So .. we have our XML schema, and we have our JS file created, but we haven’t actually DONE anything with them yet.

    So lets create a method to register our new Contextual Tab:
    private void AddContextualTab()
            {
                //Gets the current instance of the ribbon on the page.
                Microsoft.Web.CommandUI.Ribbon ribbon = SPRibbon.GetCurrent(this.Page);
                //Prepares an XmlDocument object used to load the ribbon extensions.
                XmlDocument ribbonExtensions = new XmlDocument();
                //Load the contextual tab XML and register the ribbon extension.
                ribbonExtensions.LoadXml(this.contextualTab);
                ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ContextualTabs._children");
                //Load the custom templates and register the ribbon extension.
                ribbonExtensions.LoadXml(this.contextualTabTemplate);
                ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.Templates._children");
            }
    So .. this method is basically using the SPRibbon object to get a reference to the Ribbon on the current page. It is then loading in our XML schema to register a new contextual tab).
    (Eventually we will end up calling this method from the PreRender() event).

    Now we are going to need to register our JavaScript, and strangely enough we are going to do that with yet more JavaScript! (yes .. when you are working with the Ribbon JavaScript really is word of the day!)
    public string DelayScript
            {
                get
                {
                string webPartPageComponentId = SPRibbon.GetWebPartPageComponentId(this);
                return @"
                <script type=""text/javascript"">
                //<![CDATA[
                function _addCustomPageComponent()
                {
                    var _customPageComponent = new ContextualTabWebPart.CustomPageComponent('" + webPartPageComponentId + @"');
                    SP.Ribbon.PageManager.get_instance().addPageComponent(_customPageComponent);
                }
                function _registerCustomPageComponent()
                {
                    SP.SOD.registerSod(""CustomContextualTabPageComponent.js"", ""\/_layouts\/CustomContextualTabPageComponent.js"");
                    SP.SOD.executeFunc(""CustomContextualTabPageComponent.js"", ""ContextualWebPart.CustomPageComponent"", _addCustomPageComponent);
                }
                SP.SOD.executeOrDelayUntilScriptLoaded(_registerCustomPageComponent, ""sp.ribbon.js"");
                //]]>
                </script>";
                }
            }
    The really important part of this is the first line:
    SPRibbon.GetWebPartPageComponentId(this);
    This gets a unique reference for the instance of your Web Part, on the current page, in the context of the Ribbon. This is used to effectively identify your Web Part when someone clicks on it!
    The other really important bit is the last line:
    SP.SOD.executeOrDelayUntilScriptLoaded(_registerCustomPageComponent, ""sp.ribbon.js"");
    This is the new “Script On Demand” (SOD) method which allows us to tell SharePoint not to try loading our JavaScript until the SP.Ribbon.JS has already been processed!
    Once that has been done we need to implement our WebPartContextualInfo method:
    public WebPartContextualInfo WebPartContextualInfo
            {
                get
                {
                    // create objects for the contextual web part tab
                    WebPartContextualInfo info = new WebPartContextualInfo();
                    WebPartRibbonContextualGroup contextualGroup = new WebPartRibbonContextualGroup();
                    WebPartRibbonTab ribbonTab = new WebPartRibbonTab();
                    //Create the contextual group object and initialize its values.
                    contextualGroup.Id = "Ribbon.CustomContextualTabGroup";
                    contextualGroup.Command = "CustomContextualTab.EnableContextualGroup";
                    contextualGroup.VisibilityContext = "CustomContextualTab.CustomVisibilityContext";
                    //Create the tab object and initialize its values.
                    ribbonTab.Id = "Ribbon.CustomTabExample";
                    ribbonTab.VisibilityContext = "CustomContextualTab.CustomVisibilityContext";
                    //Add the contextual group and tab to the WebPartContextualInfo.
                    info.ContextualGroups.Add(contextualGroup);
                    info.Tabs.Add(ribbonTab);
                    // fetch dynamic component info for the current page's Ribbon control
                    info.PageComponentId = SPRibbon.GetWebPartPageComponentId(this);
                    return info;
                }
            }
    Now lets take a quick look through some of this code first. The first thing you should notice is that there are 3 new classes provided in the OOB API specifically for providing contextual tabs (from Web Parts):
    • WebPartContextualInfo
    • WebPartRibbonContextualGroup
    • WebPartRibbonTab
    These objects contains all of the core functionality that you will need to handle the interaction between selecting your Web Part in edit mode, and the Ribbon dynamically popping up your Tab when that happens.
    The RibbonContextualGroup and RibbonTab objects then get given both an ID property and a VisibilityContext. These values refer to the same pointers in the XML schema definition for the Tab, Group and Controls that we are going to register (which we created earlier).
    The final part of the puzzle is to add these to the Web Part’s load stack (in this case, the Pre-Render method):
    protected override void OnPreRender(EventArgs e)
    {
                base.OnPreRender(e);
                this.AddContextualTab();
                ClientScriptManager clientScript = this.Page.ClientScript;
                clientScript.RegisterClientScriptBlock(this.GetType(), "ContextualTabWebPart", this.DelayScript);
    }
    So, we are registering our contextual tab (using the AddContextualTab method we created earlier).
    We then dynamically add a “lazy load” reference to our “DelayScript” string, which will register all of the JavaScript functions that we are using.

    Build / Deploy / Test
    There you have it … a contextual tab in edit mode!



    Make sure you check back for:


  • RCWP Part 3 – Edit Web Part using a Ribbon modal dialog


  • (Full source code for the solution will be published in Part 3)

    RCWP Part 1 – SPRetreat and the Related Content Web Part

    I’m sat on the train after a great day of SPRetreat (followed by SharePint of course!), superbly organised by Andrew Woodward (21Apps) and Ben Robb (CScape). It was a really good day of innovative ideas, problem solving, chewing the fat (and the occasional dirty joke... you know who you are!).

    The core challenge thrown down for the day involved trying to provide cross-site (collection) “related information”, effectively a “cross-pollination” function, using SharePoint 2010. There were some great ideas and a lot of top effort into involving the Managed Metadata Service, Custom Search API work and some cracking Scrum / Agile design processes.

    We had 5 sessions of 1 hour each, and my efforts for the day mostly revolved around delivering a “Related Content Web Part”, which could use Search to show other content from any data source which is in some way related to the information on the current page.

    In this post I’m going to walk through how my efforts of the day culminated in the “Related Content Web Part” but ended up being a generic “Dynamic Field Driven Search” web part, basically allowing a set of search results to be displayed based on the value of a field that is stored in the publishing page (i.e. content type) that contains the web part (which derived from the Search CoreResultsWebPart).

    In the final sessions we though about how to improve this, and ended up building a custom contextual ribbon interface to surface SP Modal Dialogs to allow easy updating of core web part properties.
    Core Functionality

    The functionality is really split into 3 major sections:
    (Full source code for the solution will be published in Part 3)

    RCWP Part 1 - Extending the Core Results Web Part
    This is one of the nicest new “features” of SharePoint 2010. They have stopped sealing all of the Web Parts (and Web Part Connections)that are used for the results pages in SharePoint Search solutions. This means it is now much easier for you to extend and add-value to these web parts without having to throw out all of the OOB functionality.
    The reason for using the CoreResultsWebPart was simple;
    • Using search is fast, efficient, cross farm and highly configurable.
    • The core results web part using XSLT for rendering, so easy to design the output.
    • Leveraging an OOB web part means we get loads of added functionality for free! (like specifying which scope we want to use).
    In this solution, we extended the CoreResultsWebPart to create our own Web Part. Simple create a new Visual Studio 2010 “Web Part” item and set it to inherit from “CoreResultsWebPart” (you will need to add a reference to Microsoft.Office.Server.Search.dll).
    [ToolboxItemAttribute(false)]
    public class RelatedContentWebPart : CoreResultsWebPart
    {
    }
    In terms of functionality we need to do 1 thing:
    Override the Query programmatically, based on the metadata of the current page.
    This involved a few steps. First off, we need to identify which field we want to be “targeting”. For this we created a simple string field, exposed as a Web Part Property.
    private string fieldName = "Title";
    ///<summary>
    /// The field on the current page we want to use for filtering
    ///</summary>
    [WebBrowsable(true)]
    [Personalizable(PersonalizationScope.Shared)]
    [WebDisplayName("Field Name")]
    [SPWebCategoryName("Filter SPR")]
    [WebPartStorage(Storage.Shared)]
    [Description("Which field on the current page do you want to use for filtering?")]
    public string FieldName
    { get { return fieldName; } set { fieldName = value; } }
    Then we needed to override the query itself. This is simply done by setting the “FixedQuery” property of the CoreResultsWebPart. The trick here is you need to set this in the “OnInit” event, otherwise it won’t take effect (if you try to place it in OnLoad, CreateChildControls or any other later method then it won’t have any effect!).
    protected override void OnInit(EventArgs e)
    {
        this.FixedQuery = “keyword string value”;
        base.OnInit(e);
    }
    Finally, we need to make sure we are pulling out the field value of the current list item, based on our custom field. For this we used a simple set of SPContext combined with some defensive programming to make sure we don’t get any NullReferenceException errors. So change the “OnInit” event to the following:
    protected override void OnInit(EventArgs e)
    {
        if (!string.IsNullOrEmpty(fieldName))
        {
            if(SPContext.Current.ListItem.Fields.
                ContainsFieldWithStaticName(fieldName))
            {
                this.FixedQuery =
                    SPContext.Current.ListItem[fieldName].ToString();
            }
        }
        base.OnInit(e);
    }
    After that … Build / Deploy and the web part was working!



    The code could obviously be re-factored a little bit, but on the whole it’s all working :)
    Make sure you check back for:


  • RCWP Part 2 – Web Part with Ribbon Contextual-Tab
  • RCWP Part 3 – Edit Web Part using a Ribbon modal dialog


  • (Full source code for the solution will be published in Part 3)

    Friday, 25 June 2010

    Content and Code wins Microsoft Partner of the Year Awards

    Its that time of year again, and the Microsoft WPC (Worldwide Partner Conference) is almost upon us (Washington D.C., USA, July 11th-15th).

    But before the conference kicks off Microsoft has announced the award finalists and winners, and Content and Code has won two categories:
    • Microsoft Worldwide Partner of the Year, Information Worker Solutions, Enterprise Content Management (link)
    • Microsoft Country Partner of the Year, UK (link)
    I am incredibly proud of Content and Code for winning these awards, not least because the award was attained through the RNIB project which I worked on (along with a fantastic team at both Content and Code and the RNIB!). This is a great achievement, and I'm both proud and privileged to have worked on that project, and for Content and Code themselves!

    To top this off, Content and Code won Microsoft Worldwide Partner of the Year, Information Worker Solutions, Portals and Collaboration for 2009, so this now makes 2 years running that Content and Code have won a Worldwide Partner of the Year recognition!

    The official announcement can be found on the Worldwide Partner Conference site.

    Friday, 9 April 2010

    Speaking at the SharePoint Evolution Conference, London

    For those who don't know, the SharePoint Evolution Conference 2010 in London is fast approaching. It's 3 days of SharePoint antics with over 70 sessions dedicated to SharePoint professionals and the imminent launch of SharePoint 2010.

    I will also be speaking in the Community Track (COM109) on Tuesday 20th April, 2pm-3pm, presenting alongside Kelly Harrison from the RNIB about some of the challenges and lessons learned from building a fully accessible SharePoint system.

    It looks to be a really great event, with over 55 expert speakers, from both Microsoft and other well-known companies. Find out more reasons why you should attend and hopefully I'll see you there!

    Thursday, 26 November 2009

    Building an Accessible SharePoint System - Slide Decks, Source Code and Downloads (SUGUK London - November 25th)

    First of all a big thank you to everyone who attended the session, and many thanks to Chris O'Brien for his presentation on ECM in SharePoint 2010 and also to Matt Taylor for pulling the strings behind the scenes and getting it organised!

    You can find links to all of the Slide Decks and Source Code that was used in the Building Accessible SharePoint Systems session below.

    There is loads of material, with links to all of the tools and websites I mentioned including the Disability Discrimination Act, the WCAG 2.0 and WAI ARIA guidelines, the new online SharePoint 2010 SDK and the ASP.Net 4.0 Whitepaper ... plus links to all of the tools that were mentioned.

    The slides also include notes on each of the topics and the demo notes refer to the source files that were used in the demo!

    In the mean time if anyone wants to contact me with any questions feel free to use the medium of your choice:

    Email: martin.hatch@contentandcode.com
    Twitter: @MartinHatch

    Cheers, thanks for coming and hope to see you all again soon!

    Files
    Let me know if you have any trouble accessing them.

    Otherwise you can get the individual files below:
    [Update - some of the links were broken before - fixed now!]
    Thanks again!


    Monday, 2 November 2009

    Presenting at SUGUK London 25th November

    Yep, I'm taking the plunge and finally presenting publicly :)
     
    I'm going to take the stand to talk about Developing an Accessible SharePoint System based on our experiences in designing and building the Intranet and Website for the Royal National Institute for Blind People (RNIB).
     
    I'll be going into technical detail about development techniques for customising the front-end and back-end interface of SharePoint, as well as some of the more rounded issues around accessibility (such as the age old "accessibility versus compliance" discussion).
     
    I'll also hopefully get the opportunity to show off our new SAS (SharePoint Accessibility Solution) framework and show the audience an example of a WCAG 2.0 AAA system running on MOSS 2007.
     
    Please feel free to come along (assuming you are in the London area on November 25th, arrive 6:00pm for a 6:30pm start!). It's free to attend, and Microsoft usually do a good show by providing free pizza, tea and coffee! :)
     
    You can sign up at the SUGUK forum thread here:
     
    Look forward to seeing you there!


    Tuesday, 22 September 2009

    SharePoint Conference 2009

    Yep, I am going to Vegas! :)
     
    Got confirmation of this today, which I am extremely excited about.
     
    I plan on releasing some blog content about the conference, some interesting tid-bits from the sessions. If you have any requests then please let me know.
     
    If you are also going then I'd love to meet up! Post a comment here and I'll see if we can hook up, I'll be there all week!


    Friday, 17 April 2009

    Thoughts on the European SharePoint Best Practice Conference - London

    I recently attended the Microsoft SharePoint European Best Practice Conference (6th - 8th April 2009) and wanted to share some of my thoughts.
    On the whole it was a good event, plenty of top speakers (such as Joel Oleson, Andrew Connell, Eric Shupps, Todd Bleeker ... and many more [full list here]) and certainly lots of topics and tracks to attend .. the event was well organised and catered to all tastes .. but I was left a little bit underwhelmed by the experience.

    The Good Bits
    The technical sessions (IT Pro and Dev) were excellent, especially the "ask the expert" sessions at the end of each day. These really were an opportunity to get into the nitty gritty of SharePoint with some great topics and questions coming up (some of which even caused disagreements amongst the "experts"!)

    A lot of them also tried to grasp some of the more subjective "best practice" topics like content deployment and testing methods. All in all, thoroughly enjoyable, but I did think that there wasn't a massive amount that I didn't already know.

    The Bad Bits
    The Information Worker and Business Adoption tracks were extremely disappointing. I was expecting a "Best Practice" conference to assume a high level of competence with SharePoint as a starting point, but it seems that the majority of these started off from the "so you've just bought SharePoint .." or the equally dull "so you are thinking about implement SharePoint eh?? .."

    There were some exceptions (Penny Coventry did quite a good session around locking down SharePoint Designer, which was quite useful and at the very least an engaging presentation).

    But a large amount of the conference was so under-whelming that I actually walked out halfway through a couple of sessions because the "governance" session seemed to be saying "make sure you backup your data" and "don't forget to train your users".. I really couldn't believe how dumbed down a lot of the sessions were.

    The BEST bits ...
    By far the best parts of the session is to meet and greet people at the conference .. networking was by far the best (and most enjoyable) part of the conference, especially at the "SharePint" sessions in the pub round the corner. Getting to chat to other professionals who are knowledgable and enthusiastic about SharePoint is something that I rarely get treated to outside of my office .. and it is always refreshing to get a new perspective on things.

    Highlights:
    Andrew Woodward presenting on Test Driven Development
    Chris O'Brian presenting on Content Deployment
    Andrew Connell on Field Controls & WebParts

    and of course .. the "Ask the Experts" sessions


    Thursday, 28 February 2008

    SUGUK - London Meeting

    If you don't know about them already there is a group that call themselves the "SharePoint User Group UK" (SUGUK). They meet every now and again, and quite often you'll get people from Microsoft (or MVP's) giving presentations on topics relating to SharePoint (usually either development or infrastructure).

    Well, there was one such meeting last night, covering topics such as Kerberos in SharePoint (why, when and more importantly .. how?) and another topic (very close to my heart) about how to maintain multiple SharePoint environments throughout a project lifecycle (e.g. Dev | Test | Stage | Prod).

    They are free to attend, and usually there is a good chin-wag down the pub afterwards so plenty of opportunities for networking or just getting those crucial last few bits of info on a topic.

    The SUGUK Website contains more information, including an "upcoming meetings" forum where you can keep track of when and where the next events are going to be. There's also a development forum of pretty well informed people, which might be a bit easier than the heavily oversubscribed MSDN Forums.

    Definately worth a look!


    Thursday, 7 February 2008

    when I met Bill Gates ...

    Well ok ... so I didn't actually get to meet him .. but I did see him talk, and mighty exciting it was too (unless you are one of those anti-software / anti-capitalist / anti-success people who don't like him).

    I had the fantastic opportunity of going to the Microsoft Windows Server & Tools Pre-Launch Event in London (Park Lane Hilton), which was only available to Microsoft Gold Partners (so a thumbs up there to my employers!) and very swanky and posh (but a thumbs down to the caterers ... who on earth serves steak and chicken from a buffet but doesn't provide any tables or chairs ??? ever tried to use a knife & fork while holding your own plate ??).

    Well, Bill Gates, the big man himself, was giving one of they key-note speechs about "The Miracle of Software". Basically talking about how software has evolved to enrich people's lives and what software design should be about (i.e. empowering people). It was all quite nice and they had a Q&A session afterwards (although quite blatantly pre-planned questions).

    Some of the other speakers had some interesting things to say, mostly the buzz-words were "Hardware Optimisation" and "Virtualisation" around the Windows Server 2008 "Hyper-V" technology ...  which has led us here to a bit of a conundrum ...

    You see ... it is a little known fact that the next version of SharePoint (a.k.a. Office 14) will only run on 64-bit!!!
    Now ... this isn't such a problem for the production environments, I can't even think of a non-64-bit CPU that is still being bought for production hardware these days ... but when you go into the development lifecycle things get a bit more tricky!

    You see ... at the moment (and I hope this changes) you cannot run 64-bit Virtual Machines on any Virtual Server environment (not even if your host OS is 64-bit). The only piece of technology making this possible is the new "Hyper-V" which is part of the Windows Server 2008 kernel. This is also ONLY possible if you are running a CPU that is BOTH 64-bit and has "Hardware Assisted Virtualisation" (HAV).

    That all sounded fine and dandy .. but then I got back to the office and looked at the hefty workstation on my desk ... no HAV and definately no Hyper-V either.

    So now we have a bit of a conundrum ... do I upgrade to a HAV compatible CPU? (i.e. one of the new "Quad Core" Intel Xeon processors) so that I can potentially run 64-bit virtual machines (and hence develop new SharePoint environments)?
    BUT ... if Windows Server 2008 remains the ONLY platform for 64-bit virtualisation that means I will need a Server 2008 OS to do all my development in (not really suitable for a workstation).

    Well .. I've spoken to my Infrastructure Manager and come to a plan. All the dev.team are getting brand new Quad-Core Xeon with 4GB RAM workstations.
    IF Microsoft don't release a "workstation" virtualisation platform that can run 64-bit VMs then we are going to convert them all into Servers and buy crappy "terminal" workstations .. and every developer can have their own personal "server" to work in.
    IF Microsoft DO release said software ... then hurray ! for we'll have the hardware capable of supporting it.

    hmmm .. I wonder if I can convince them to get me 30" widescreen monitors too ???? .....




    Friday, 11 January 2008

    MSDN Conference .. SharePoint for Developers ... been and gone

    Well it was quite a decent SharePoint event, and full as usual (but then I've not been to an MSDN event in London that wasn't "sold-out").
    It was mainly an "Introduction" to WSS 3.0 and MOSS 2007 with a bit of code thrown in to keep the developers happy, and to whet their appetite so that they go looking for some of the more technical details out there.

    If you are looking for the basics, some general pointers on where to get started and some information on some of the things you can do in SharePoint then this is a great place to start. If you are already an experienced SharePoint developer then don't expect to get much out of this.

    If you wanted to see the event slides (and a video of the event from a previous conference) then you can get them all from the MSDN events page.


    Wednesday, 9 January 2008

    MSDN Conference .. SharePoint for Developers

    Well, going to the MSDN conference "SharePoint for Developers" tomorrow, at Microsoft's Victoria offices in London.


    I've even managed to arrange a meeting with the 2 presenting speakers :) (one of whom is a member of the Microsoft UK Developer Team).

    Going to see if I can get any insider information on SharePoint from them, hope so.

    Looking forward to the conference in any case (it's the first SharePoint development one I've seen this year) .. also hope the coffee isn't too strong like it was last time ;)