All about the SharePoint ribbon

25
All about the SharePoint Ribbon Shai Petel MCT, VP R&D [email protected]

description

Developers guide for customizing the SharePoint 2010 server ribbon. Code sample is embeded in the power point, so download to get it!

Transcript of All about the SharePoint ribbon

Page 1: All about the SharePoint ribbon

All about the SharePoint

RibbonShai Petel

MCT, VP R&[email protected]

Page 2: All about the SharePoint ribbon

WARNING!

There will be extensive visual studio use throughout this presentation!

Page 3: All about the SharePoint ribbon

Topics

• Introducing the Ribbon• SPRibbon Architecture• Customizing the SPRibbon

Page 4: All about the SharePoint ribbon

Introducing the Ribbon

• Office ribbon: File menu and quick access toolbar:

• SharePoint ribbon: Site Actions menu, Navigate Up and Edit page quick access buttons

Page 5: All about the SharePoint ribbon

Introducing the RibbonCommon tabs

• The “Browse” tab

• The “Page” tab

Page 6: All about the SharePoint ribbon

Introducing the RibbonCommon tabs

• The “Items” tab

• The “List” tab

Page 7: All about the SharePoint ribbon

Introducing the RibbonCommon tabs

• “On demand” functionality with contextual tabs

Page 8: All about the SharePoint ribbon

Introducing the RibbonCommon tabs

• Context-sensitive operations with controls status

Page 9: All about the SharePoint ribbon

Topics

• Introducing the Ribbon• SPRibbon Architecture• Customizing the SPRibbon

Page 10: All about the SharePoint ribbon

SPRibbon ArchitectureObjects Hierarchy

Ribbon

Tabs

Tab *

Contextual Tabs

Contextual Group

*

Tab *

Page 11: All about the SharePoint ribbon

SPRibbon ArchitectureObjects Hierarchy

Tab Groups Group * Controls

Control*

Page 12: All about the SharePoint ribbon

SPRibbon ArchitectureObjects Hierarchy

Objects are defined in XML or in JSON.

Example:TEMPLATE\GLOBAL\XML\CMDUI.XML

(Humans prefer XML…)

Page 13: All about the SharePoint ribbon

SPRibbon ArchitectureRibbon Communication

PageManager

CommandDispatcher

PageComponent

•One per page•Registers all PageComponent objects

•Handles PageComponent objects and the commands they can handle

•When a command is received, the CommandDispatcher recieves it and passes it to all PageComponent objects that can handle it.

•ECMAScript Object•Handle commands passed by the CommandDispatcher

•Use ECMAScript to register an instance of your PageComponent with the PageManager. Only then it can respond to commands defined in the ribbon XML

• (* Can be declared inline with the ribbon controls XML)

Page 14: All about the SharePoint ribbon

Topics

• Introducing the Ribbon• SPRibbon Architecture• Customizing the SPRibbon

Page 15: All about the SharePoint ribbon

Customizing the SPRibbonGeneral info

• Declaring controls• Handling commands• Associating your ribbon tabs

Page 16: All about the SharePoint ribbon

Customizing the SPRibbonGeneral info

• Declaring controls– Declare Ribbon controls in feature XML– Injext XML to SPRibbon using

ribbon.RegisterDataExtension• Handling commands• Associating your ribbon tabs

Page 17: All about the SharePoint ribbon

Customizing the SPRibbonGeneral info

• Declaring controls• Handling commands

– Declare command handlers inline in the XML– Register a PageComponent to handle more

complex commands (such as lazy load)• Associating your ribbon tabs

Page 18: All about the SharePoint ribbon

Customizing the SPRibbonGeneral info

• Declaring controls• Handling commands• Associating your ribbon tabs

– Associate with a list template or content type– Use code to bring un-associated tabs to view– Associate web part with contextual group tabs

Page 19: All about the SharePoint ribbon

CUSTOMIZING THE SPRIBBON

Code + demo(See demo script in README.txt inside VS project)

MyServerRibbon 2010-07-13.zip

Page 20: All about the SharePoint ribbon

Nice to know…

• Use JS objects to avoid conflicts• The ribbon shows informative formatting

errors 9 times out of 10

Page 21: All about the SharePoint ribbon

Nice to know…

• Some controls cannot be large / medium / small. Checkbox cannot be large.

• If you inject to existing node (_children) you can only inject one child at a time. Create CommandUIDefinition for each injection.

• Documentation error: group template and template alias are not optional!

Page 22: All about the SharePoint ribbon

Nice to know…

• SPRibbon in not accessible from sandboxed code!

• Dispatch command manually: SP.Ribbon.PageManager.get_instance().get_commandDispatcher().executeCommand(Commands.CommandIds.ApplicationStateChanged, null);

Page 23: All about the SharePoint ribbon

Topics

• Introducing the Ribbon• SPRibbon Architecture• Customizing the SPRibbon

Page 24: All about the SharePoint ribbon

See also

• Server Ribbon visual studio extensibility project: http://code.msdn.microsoft.com/vsixforsp

• PageComponent more info:http://msdn.microsoft.com/en-us/library/bb383792.aspx

• Shai's Blog:http://kwizcom.blogspot.com

• Chris O'Brien ribbon blog (Beta!) can be found here: http://www.sharepointnutsandbolts.com/2010/01/customizing- ribbon-part-1-creating-tabs.html

• MSDN How-To Webpart with contextual ribbon: http://msdn.microsoft.com/en-us/library/ff407578.aspx

Page 25: All about the SharePoint ribbon

Questions?

=2B |! 2B ? FullTrust:Sandbox;