0

I was wondering whether there is somekind of reference available with the javascript methods called for each of the buttons in the ribbon. Question behind the question: I want to make a button on a wiki page which says "edit me", without the user having to go to the same button in the ribbon. Functionality should be exactly the same, but I need it on a different place. So what is the easiest way to find out which code the ootb "edit" button calls?

3

Here's a link that helped me out when I needed to find out what javascript function is bound to each ribbon button.

Basically, the steps you have to follow are (applies to sp2010, the might be slight differences in sp2013):

  1. Find the id attribute of the ribbon button. eg. Ribbon.EditingTools.CPEditTab.Markup.Html.Menu.Html.EditSource-Menu16. Next go to 14 hive and under TEMPLATE\GLOBAL\XML\ find cmdui.xml file. This file contains the definition for all ribbon buttons in SharePoint. Search in this file by word Ribbon.EditingTools.CPEditTab.Markup.Html.Menu.Html.EditSource

  2. Consider the Command attribute (which, in the example, is equal to EditSource)

  3. search this command among SharePoint javascript files. Common architecture of ribbon handler involves javascript "classes" which can handle particular command. Each class has canHandleCommand method. Search under 14\layouts using pattern *.js by word (in the example, “EditSource”). Find handleCommand method in the class and take note of the line number.

  4. in browser find this line and set a breakpoint, then you can step into to find the exact code that will be called (in the example, RTE.RichTextEditor.editSource() ). This is the handler

1

All you need to to is to pass some query strings to the aspx page without any JS call. As like in wiki this goes like this.

<a href="/demo/wiki/Seiten/home.aspx?**ControlMode=Edit**&amp;**DisplayMode=Design**"&gt;Edit this page&lt;/a>

This works for every page and not only for wiki page. The valid control mode values can be found on the MSDN as the values for the display mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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