Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to add a custom action in the Ribbon.EditingTools.CPEditTab.Markup group. My goal is to add a button that fires a custom javascript that inject som html content in the rich editor control of a wiki site (related to my previous question).

When I try with SPD, even if I can write Ribbon.EditingTools.CPEditTab.Markup, the custom action is not displayed.

How can I add such custom action using either SPD or Powershell ?

I've also tried with a Powershell script like this :

$site = Get-SpSite "http://server/sites/coll"
$ca = $site.UserCustomActions.Add()
$ca.Name = "test"
$ca.Title = "Test"
$ca.Location = "Ribbon.EditingTools.CPEditTab.Markup"
$ca.Url = "javascript:alert('Working')"
$ca.Update();

Please note this is a custom action used for only one site. I'd like to avoid to create a feature for this purpose.

share|improve this question

2 Answers 2

I'm not sure if building plain SPD solution could be possible or at least easy. There are ways to extend ribbon actions using javascript, by somehow injecting into the process, but i'm not sure if it can be done truly without server side code.

For example, you could follow this link how to manipulate ribbon from javascript, create javascript file using SPD and modify Master Page to include this file.

But i would suggest creating sharepoint solution (even sandbox might be enough).

As for powershell script, you have to include CommandUIExtension property with valid xml, where you can describe your controls (i.e. buttons) and commands (i.e. javascript:alert('test')

share|improve this answer

This should help you http://msmvps.com/blogs/cobrien/archive/2010/01/25/adding-ribbon-items-into-existing-tabs-groups-ribbon-customization-part-2.aspx

To only activate for a single sub-site, make sure your Feature is targeted to a WEB, which should then be activated for your web only.

Hope it helps, C:\Marius

share|improve this answer
1  
I've read this article. My question was targeting SPD or maybe PS. Here I'll have to buidl a feature, package, etc. which I wanted to avoid. –  Steve B May 15 '12 at 12:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.