Welcome on my SharePoint 2010 blog

Hello,

My name's Roy. I'm a dutch SharePoint & BI consultant/architect at Advantive B.V. At this moment I'm busy with some big SharePoint 2010 projects in The Netherlands. In all the projects I've got different roles, like: Business consultancy, Lead Consultant, Architect (logical and technical), Development and Teaching/courses.

Products where you can ask me about are: SharePoint, Visual Studio, SQL Server, PowerPivot, Analysis and Reporting Services, Visio Services, InfoPath, PerformancePoint Services, Team Foundation Server, Office line.

I love to work and to write about Microsoft SharePoint 2010 so, feel free and read/comment my Blogs!

Greetz.

Wednesday, October 20, 2010

Extending the ribbon: Webpart contextual tabs

This Blog will talk about creating a webpart contextual ribbon tab" in SharePoint 2010 on a high level.

With this solution the tab(s) will be visible when the specific webpart will be on the page.

Create a SharePoint visual studio 2010 visual webpart project with the following ingredients:
  • JS.file
  • WebPart
  • XML-files
The js.file contains the functions and methods to put the necessary tabs, groups and buttons to the ribbon.

In the XML-files you can find the tab and the groups with it's buttons and it's behaviour. In this file you can only find a shortcut to the event handler that will be fired when the button in the ribbon is clicked. In the feature the xml sections will be added to the cmdgui.xml file in the 14-hyve. The ribbon tab is a normal ribbon tab and not a contextualtab (like doc library (documents, library)).

The WebPart contains code in the prerender method to:
  • read the xml-files for the tabgroups and tabs
  • put the xml in the OOB SharePoint cmdgui.xml file
  • put in some code for the event handler
  • Include the javascript file

1 comment: