Use standard buttons

Mar 17, 2012 at 1:56 PM

First of all, congratulations for your project.

 I'd like to know if it is possible to use the features of the standard buttons of the SP. I know that exist in the namespace ControlLibrary.StandardButtons the definition of these buttons but they do nothing like you sayed in documentation "By default, all these buttons will be dummy (do nothing)." How i can call the command associated to these buttons?


Coordinator
Mar 17, 2012 at 4:43 PM

Great question, thanks!

Unfortunately, Fluent Ribbon doesn't support calling SharePoint ribbon actions at the moment.

I think you could try to dig around SP.Ribbon.PageManager.executeRootCommand method, it seems to be a good starting point.

I will try to perform my own investigations on the topic, and if I will be able to find a solution, I'll write back at once.

Mar 17, 2012 at 5:42 PM

Thanks for your reply. 

I followed your advice and tried using the method executeRootCommand

"SP.Ribbon.PageManager.executeRootCommand(commandId, properties, commandInfo, root)"

however i could not find information about the function parameters and i don't know the commandIds for standard buttons. Can you give me a hand?

Coordinator
Mar 17, 2012 at 8:31 PM
Edited Mar 17, 2012 at 8:33 PM

jdcorr, I'm still investigating and can't point to a working solution right now. That's why I didn't provide an example code in my previous post and instead, just proposed you to dig around the executeRootCommand method :)

But I can share some details at least. So here's what I have at the moment:

  1. Standard command ids could be found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML file. If you list particular buttons you need, I can provide their command ids for you.
  2. The proper properties parameter is passed to the handler, so you can pass it unchanged to the executeRootCommand method call.
  3. Next, based on my current investigations, I believe commandInfo parameter could be null without serious consequences.
  4. Unfortunately, I'm still doubtful about the last parameter, root, but passing null there as well looks at least worth trying :)

In sum, you should get something like this:

CommandJavaScript="SP.Ribbon.PageManager.executeRootCommand('CommandId', properties, null, null);"

Again, I'm not sure it will work.