This is a quick post to show how to creating a good looking Icon for your SharePoint custom action. First create the icon Download Metro Studio from Syncfusion. This will allow you to select an icon from a huge range of royalty-free icons. Pick the icon which best suites your custom ribbon action. You will need two icons. One 32px and one 16px. Choose the colour for your icon and set the background to transparent. Then simply export both versions as a PNG. Encode your image I tend to encode the images and put that in the custom action XML, so you will need to encode them. Fortunately Richard diZerega created a tool to do this easily for us. This will encode the image into a base64 string, which we can then use in our custom action definition. Modify the Custom Action Once you have the file encoded you can then change the Image32by32 and the Image16by16 in your custom action definition. And there you go, a quick simple icon for your custom action.
Today I wanted to add a custom action to a calendar in a SharePoint App. Thought it would be straight forward, but apparently not. Adding the custom action is fine… Selecting ‘Calendar’ as the list template to associate the custom action with is simple. You then get a choice of where you want the action to appear. I want it on the Events Actions ribbon menu. Easy enough, well that’s not quite right as the List is not exhaustive and misses out completely the Calendar ribbon locations. Turns out that even though you chose a calendar list template it does not offer you the ribbon locations available to a Calendar. So don’t use ‘Ribbon.ListItem.Actions’ as your location, use ‘Ribbon.Calendar.Events.Actions.Controls._children’ instead. This is the correct location to use to add a command to the calendar ribbon. By using this location your custom ribbon action will appear in the events lists on your App’s host site. These locations can be found in ‘15\TEMPLATE\GLOBAL\XML\CMDUI.XML’, but I find it easier to use the developer tools in IE to get the locations. If you look at the ribbon with the DOM Explorer then you can see a list of the locations in the IDs of the section containers. If find this a quicker easier way to find out ribbon locations you need to use.