4

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.

2 Answers 2

1

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')

0

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

1
  • 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
    Commented May 15, 2012 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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