About Me

I've been working with SharePoint for about 4 years now, which is a lot of a 24 year old's career! I both love it and hate it :-) I wouldn't say I specialise in anything, just SharePoint! I am a dev, so some of my posts will contain XML, C#, references to the 14 hive, but I'm also an admin so will often talk about stsadm, powershell and central admin. Some of my blog posts may be very simple references to improve coverage of common pitfalls, some may be in-depth walkthroughs, and some may just be a rant!

Monday, 21 March 2011

SharePoint 2010 - Creating a custom ribbon button/s to be displayed only in the calendar view ribbon.

Before I start, this is not an original blog! I used this fantastic four-part blog from Chris O'Brien (http://www.sharepointnutsandbolts.com/2010/01/customizing-ribbon-part-1-creating-tabs.html) to learn how to create a custom ribbon control. Then all I wanted to do was make my group only appear for the calendar view ribbon, so I thought I'd just share how to do that in case someone is after the same thing and wants a quick solution. All credits on the code used go to Chris O'Brien, I just altered it for my needs.

See the code below...


I've highlighted three important groups...

  1. Grey - This shows that all of my IDs start with BM.SharePoint.Ribbon.NewGroupInExistingTab. This isn't coincidence, it's important to ensure that the ribbon group even shows in the first place. Without this consistency it will not show!
  2. Yellow - here is what you came for :-) this is how to get a group of buttons into just the Calendar's "Events" tab. If you wanted it in the "Calendar" tab, you'd replace the word "Events" with "Calendar" in all of the yellow highlighted bits
  3. Aqua blue - The "Command" attribute in the "Button" declaration must be the same as the "Command" attribute in the respective CommandUIHandler section! Otherwise the buttons will do nothing when you click them.
Enjoy ^_^

No comments:

Post a Comment