SlideShare a Scribd company logo
1 of 42
Leveraging the Ribbon API and Dialog Framework Cory Peters Chief SharePoint Architect Eastridge Technology, Inc.
About Me Chief SharePoint Architect at Eastridge Technology, Inc. Microsoft Gold Partner focused on the south east and based out of North Carolina Working with SharePoint since Portal Server 2003 Worked with all aspects of SharePoint including Branding Development Administration Implementation Architecture
Leveraging the dialog framework Creating, deploying and interacting with dialogs
Dialog goals Understand how dialogs work How to create a dialog How to pass data to/from a dialog What’s involved in deploying a custom dialog
how it works Use returnVal for further processing or display result Perform any OM or Client OM functionality Page / Web Part Dialog showModalDialog url, callback callbackFunction dialogResult, returnVal OK Cancel dialogResult (int)  ,[object Object]
0 = CancelreturnVal (string) Application Page
SP.UI.ModalDialog SP.UI.ModalDialog.showModalDialog(options) Options parameter url title allowMaximize showClose width height dialogReturnValueCallback
creating a dialog varoptions = SP.UI.$create_DialogOptions(); options.url = "/_layouts/Ex/CustomPage.aspx"; options.width= 400; options.height= 400; options.dialogReturnValueCallback= Function.createDelegate(null, customCallback); SP.UI.ModalDialog.showModalDialog(options);
Getting data into a dialog Creating the Dialog varoptions = SP.UI.$create_DialogOptions(); options.url = "/_layouts/Ex/CustomPage.aspx?p1=value&p2=v1;v2;v3"; … Within the ApplicationPage string param1 = Request.QueryString[“p1”]; string[] param2 = Request.QueryString[“p2”].Split(‘;’);
Getting data from a dialog var form = document.forms.<%SPHttpUtility.NoEncode(Form.ClientID,Response.Output);%>; varitemTitle = 	form.<%SPHttpUtility.NoEncode(itemTitleTextbox	.ClientID,Response.Output);%>.value;
closing a dialog OK Button Clicked SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, ‘Return Data’); Cancel Button Clicked SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, 'Canceled');
Processing the result Callback receives two parameters: dialogResult and dialogData if (dialogResult === SP.UI.DialogResult.OK) { 	// use client OM for further processing } if (dialogResult=== SP.UI.DialogResult.cancel) { SP.UI.Notify.addNotification(“Dialog was 	canceled. ", false); }
dialog demo
Customizing the ribbon XML, XML and some JavaScript!
Ribbon goals Learn common terminology Have a better understanding of the Ribbon XML Know what’s involved in a ribbon customization See how all the pieces play together
RIBBON OVERVIEW Defined via XML within <CustomAction> and feature deployed Tabs can be visible/hidden Controls can be enabled/disabled * No custom controls (.ascx) Heavy JavaScript required / Client OM Complex, nested, relational XML
RIBBON XML TERMINOLOGY Ribbon Tab Contextual Tab Group Section Row Control
Targeting ribbons CustomAction Location
AVAILABLE CONTROLS CONTAINERS Tab Group CONTROLS Button CheckBox Color Picker Combo Box Drop Down Flyout Anchor Insert Table Label Menu Menu Section MRU Split Menu Spinner Split Button Textbox Toggle Button
control displays DisplayMode Display modes listed are not available for all controls.
What makes up a ribbon? Ribbon XML Defines the tabs, groups, controls, rendering templates JavaScript CommandUIHandler or a custom Page Component Handles populating Dropdowns, on click events, etc Delegate Control One approach to getting your custom JavaScript loaded into the page Note: Any method of getting your JavaScript into the page is fine
RIBBON XML CommandUIExtension CommandUIDefinition CommandUIHandlers
RIBBON XML CommandUIExtension CommandUIDefinition
RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Tab
RIBBON XML CommandUIExtension CommandUIDefinition Tab
RIBBON XML CommandUIExtension GroupId CommandUIDefinition Tab Scaling Groups MaxSize Group Controls Scale Etc Button DropDown MaxSize Scale Group Controls Etc Button DropDown GroupId
RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Tab
RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate
RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Layout Section Row ControlRef ControlRef Row ControlRef ControlRef Section
RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Tab
RIBBON XML CommandUIExtension Template Id CommandUIDefinition GroupTemplate Tab Layout Groups Section Group Row Controls ControlRef ControlRef Button DropDown TemplateAlias Scaling MaxSize Scale Size
RIBBON XML CommandUIExtension CommandUIDefinition CommandUIHandlers
RIBBON XML CommandUIExtension CommandUIHandlers
RIBBON XML CommandUIExtension CommandUIHandlers Two attributes: Command, CommandAction Command is a unique identifier CommandAction is JavaScript, URL or anything that was previously used in an UrlAction CommandUIHandler CommandUIHandler CommandUIHandler CommandUIHandler CommandUIHandler
RIBBON XML CommandUIExtension CommandUIHandlers CommandUIDefinition
RIBBON XML CommandUIExtension CommandUIHandlers CommandUIDefinition CommandUIHandler Tab Groups CommandUIHandler Group CommandUIHandler Controls Button DropDown Group Command Id Controls Button DropDown
Command UI Handler Maps a control to set of JavaScript Very powerful when coupled with the Client OM Example <Button  Id=“ButtonId" Command=“ButtonCommand“ … /> <CommandUIHandler Command=“ButtonCommand“ CommandAction="javascript: SP.UI.Notify.addNotification(‘Button was clicked');"/>
Page Component JavaScript class that serves as the middle man between the Ribbon and your customization Uses a structured contract that the Ribbon understands
Page Component (cont) Create your custom page component class Register your namespace Register your class to inherit from CUI.Page.PageComponent Initialize the page component CP.SharePoint.RibbonExample.PageComponent.initializePageComponent = function () { varribbonPageManager= 				  SP.Ribbon.PageManager.get_instance(); if (null !== ribbonPageManager) { ribbonPageManager.addPageComponent(CP.SharePoint.RibbonExample.PageComponent.instance);     } }
Delegate Control Load SharePoint Prerequisites <SharePoint:ScriptLinkName="SP.js" runat="server" LoadAfterUI="true” … /> <SharePoint:ScriptLink Name="CUI.js" runat="server" LoadAfterUI="true" … /> Load Custom JavaScript <SharePoint:ScriptLink Name="/_layouts/RibbonExample/sp.ui.RibbonExample.js" runat="server" LoadAfterUI="true“ … /> Initialize  Our Page Component <script type="text/javascript"> //<![CDATA[     function initializeRibbonExample() { CP.SharePoint.RibbonExample.PageComponent.initialize();     } ExecuteOrDelayUntilScriptLoaded(initializeRibbonExample, 'sp.ui.RibbonExample.js');    //]]> </script>
Getting current Context Get List of Selected Items // Returns a collection of item ids varctx = SP.ClientContext.get_current(); varitems = SP.ListOperation.Selection.getSelectedItems(ctx); Get Selected List // Returns a guid SP.ListOperation.Selection.getSelectedList()
ribbon demos

More Related Content

What's hot

Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
Doncho Minkov
 
User guide
User guideUser guide
User guide
nhockiki
 

What's hot (19)

Zoho Creator Presentation
Zoho Creator PresentationZoho Creator Presentation
Zoho Creator Presentation
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
 
Pub101 slideshare oct2010
Pub101 slideshare oct2010Pub101 slideshare oct2010
Pub101 slideshare oct2010
 
WPF
WPFWPF
WPF
 
Windows presentation foundation
Windows presentation foundationWindows presentation foundation
Windows presentation foundation
 
[Workshop] Single Sourcing with the Technical Communication Suite: Using Fram...
[Workshop] Single Sourcing with the Technical Communication Suite: Using Fram...[Workshop] Single Sourcing with the Technical Communication Suite: Using Fram...
[Workshop] Single Sourcing with the Technical Communication Suite: Using Fram...
 
An Overview Of Wpf
An Overview Of WpfAn Overview Of Wpf
An Overview Of Wpf
 
Creating Acessible floating labels
Creating Acessible floating labelsCreating Acessible floating labels
Creating Acessible floating labels
 
Creating a quiz using visual basic 6
Creating a quiz using visual basic 6Creating a quiz using visual basic 6
Creating a quiz using visual basic 6
 
Power Point Unit B
Power Point Unit BPower Point Unit B
Power Point Unit B
 
Building Data Centric Apps in WPF
Building Data Centric Apps in WPFBuilding Data Centric Apps in WPF
Building Data Centric Apps in WPF
 
Power point unit a
Power point unit aPower point unit a
Power point unit a
 
Html tag ref
Html tag refHtml tag ref
Html tag ref
 
Gl13 m5-c2-presentation
Gl13 m5-c2-presentationGl13 m5-c2-presentation
Gl13 m5-c2-presentation
 
Fewd week7 slides
Fewd week7 slidesFewd week7 slides
Fewd week7 slides
 
Power Point 2010
Power Point 2010 Power Point 2010
Power Point 2010
 
User guide
User guideUser guide
User guide
 
Salesforce Winter Release
Salesforce Winter ReleaseSalesforce Winter Release
Salesforce Winter Release
 
FlexNet Delivery and FlexNet Operations On-Demand Tips & Tricks
FlexNet Delivery and FlexNet Operations On-Demand Tips & TricksFlexNet Delivery and FlexNet Operations On-Demand Tips & Tricks
FlexNet Delivery and FlexNet Operations On-Demand Tips & Tricks
 

Similar to Leveraging the Ribbon API and Dialog Framework

Share point 2010-uiimprovements
Share point 2010-uiimprovementsShare point 2010-uiimprovements
Share point 2010-uiimprovements
LiquidHub
 
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And DxlBp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
dominion
 
Windows Forms 2.0 Enhancements
Windows Forms 2.0 EnhancementsWindows Forms 2.0 Enhancements
Windows Forms 2.0 Enhancements
guestd115f
 
User guide
User guideUser guide
User guide
foxyhat
 
Branding share point 2013
Branding share point 2013Branding share point 2013
Branding share point 2013
Khoa Quach
 
Griffon In Front Grails In Back
Griffon In Front Grails In BackGriffon In Front Grails In Back
Griffon In Front Grails In Back
Jim Shingler
 
Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax PluginsHnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
dominion
 
"Developing with the New User Interface Features in Microsoft SharePoint Serv...
"Developing with the New User Interface Features in Microsoft SharePoint Serv..."Developing with the New User Interface Features in Microsoft SharePoint Serv...
"Developing with the New User Interface Features in Microsoft SharePoint Serv...
Tihomir Ignatov
 

Similar to Leveraging the Ribbon API and Dialog Framework (20)

Share point 2010-uiimprovements
Share point 2010-uiimprovementsShare point 2010-uiimprovements
Share point 2010-uiimprovements
 
Grasping The LightSwitch Paradigm
Grasping The LightSwitch ParadigmGrasping The LightSwitch Paradigm
Grasping The LightSwitch Paradigm
 
JavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern ImplementationJavaScript and DOM Pattern Implementation
JavaScript and DOM Pattern Implementation
 
IBM Rational HATS Customized Amazing Features by Royal Cyber
IBM Rational HATS Customized Amazing Features by Royal CyberIBM Rational HATS Customized Amazing Features by Royal Cyber
IBM Rational HATS Customized Amazing Features by Royal Cyber
 
IBM Lotus iNotes 8.5 Customization
IBM Lotus iNotes 8.5 CustomizationIBM Lotus iNotes 8.5 Customization
IBM Lotus iNotes 8.5 Customization
 
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And DxlBp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
 
A Lap Around Visual Studio 2010
A Lap Around Visual Studio 2010A Lap Around Visual Studio 2010
A Lap Around Visual Studio 2010
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NET
 
Windows Forms 2.0 Enhancements
Windows Forms 2.0 EnhancementsWindows Forms 2.0 Enhancements
Windows Forms 2.0 Enhancements
 
User guide
User guideUser guide
User guide
 
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | EdurekaWhat is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
 
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
 
Transforming Power Point Show with VBA
Transforming Power Point Show with VBATransforming Power Point Show with VBA
Transforming Power Point Show with VBA
 
Getting the Most out of Data Page and Rich Data Definition in Portlet Factory
Getting the Most out of Data Page and Rich Data Definition in Portlet FactoryGetting the Most out of Data Page and Rich Data Definition in Portlet Factory
Getting the Most out of Data Page and Rich Data Definition in Portlet Factory
 
Branding share point 2013
Branding share point 2013Branding share point 2013
Branding share point 2013
 
Griffon In Front Grails In Back
Griffon In Front Grails In BackGriffon In Front Grails In Back
Griffon In Front Grails In Back
 
Real Estate in Hyderabad
Real Estate in HyderabadReal Estate in Hyderabad
Real Estate in Hyderabad
 
Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax PluginsHnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
 
Software Architecture New Features of Visual Studio 2010 / .Net 4.0 - Part 1...
Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1...Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1...
Software Architecture New Features of Visual Studio 2010 / .Net 4.0 - Part 1...
 
"Developing with the New User Interface Features in Microsoft SharePoint Serv...
"Developing with the New User Interface Features in Microsoft SharePoint Serv..."Developing with the New User Interface Features in Microsoft SharePoint Serv...
"Developing with the New User Interface Features in Microsoft SharePoint Serv...
 

More from Cory Peters (6)

Top 10 in SharePoint 2013
Top 10 in SharePoint 2013Top 10 in SharePoint 2013
Top 10 in SharePoint 2013
 
Ready, Set, Upgrade!
Ready, Set, Upgrade!Ready, Set, Upgrade!
Ready, Set, Upgrade!
 
Solve Todays Problems with 10 New SharePoint 2010 Features
Solve Todays Problems with 10 New SharePoint 2010 FeaturesSolve Todays Problems with 10 New SharePoint 2010 Features
Solve Todays Problems with 10 New SharePoint 2010 Features
 
SharePoint 2010 - What's New?
SharePoint 2010 - What's New?SharePoint 2010 - What's New?
SharePoint 2010 - What's New?
 
SharePoint Search Results Branding
SharePoint Search Results BrandingSharePoint Search Results Branding
SharePoint Search Results Branding
 
SharePoint 2010 - Records Management
SharePoint 2010 - Records ManagementSharePoint 2010 - Records Management
SharePoint 2010 - Records Management
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Leveraging the Ribbon API and Dialog Framework

  • 1. Leveraging the Ribbon API and Dialog Framework Cory Peters Chief SharePoint Architect Eastridge Technology, Inc.
  • 2. About Me Chief SharePoint Architect at Eastridge Technology, Inc. Microsoft Gold Partner focused on the south east and based out of North Carolina Working with SharePoint since Portal Server 2003 Worked with all aspects of SharePoint including Branding Development Administration Implementation Architecture
  • 3. Leveraging the dialog framework Creating, deploying and interacting with dialogs
  • 4. Dialog goals Understand how dialogs work How to create a dialog How to pass data to/from a dialog What’s involved in deploying a custom dialog
  • 5.
  • 6. 0 = CancelreturnVal (string) Application Page
  • 7. SP.UI.ModalDialog SP.UI.ModalDialog.showModalDialog(options) Options parameter url title allowMaximize showClose width height dialogReturnValueCallback
  • 8. creating a dialog varoptions = SP.UI.$create_DialogOptions(); options.url = "/_layouts/Ex/CustomPage.aspx"; options.width= 400; options.height= 400; options.dialogReturnValueCallback= Function.createDelegate(null, customCallback); SP.UI.ModalDialog.showModalDialog(options);
  • 9. Getting data into a dialog Creating the Dialog varoptions = SP.UI.$create_DialogOptions(); options.url = "/_layouts/Ex/CustomPage.aspx?p1=value&p2=v1;v2;v3"; … Within the ApplicationPage string param1 = Request.QueryString[“p1”]; string[] param2 = Request.QueryString[“p2”].Split(‘;’);
  • 10. Getting data from a dialog var form = document.forms.<%SPHttpUtility.NoEncode(Form.ClientID,Response.Output);%>; varitemTitle = form.<%SPHttpUtility.NoEncode(itemTitleTextbox .ClientID,Response.Output);%>.value;
  • 11. closing a dialog OK Button Clicked SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, ‘Return Data’); Cancel Button Clicked SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, 'Canceled');
  • 12. Processing the result Callback receives two parameters: dialogResult and dialogData if (dialogResult === SP.UI.DialogResult.OK) { // use client OM for further processing } if (dialogResult=== SP.UI.DialogResult.cancel) { SP.UI.Notify.addNotification(“Dialog was canceled. ", false); }
  • 14. Customizing the ribbon XML, XML and some JavaScript!
  • 15. Ribbon goals Learn common terminology Have a better understanding of the Ribbon XML Know what’s involved in a ribbon customization See how all the pieces play together
  • 16. RIBBON OVERVIEW Defined via XML within <CustomAction> and feature deployed Tabs can be visible/hidden Controls can be enabled/disabled * No custom controls (.ascx) Heavy JavaScript required / Client OM Complex, nested, relational XML
  • 17. RIBBON XML TERMINOLOGY Ribbon Tab Contextual Tab Group Section Row Control
  • 19. AVAILABLE CONTROLS CONTAINERS Tab Group CONTROLS Button CheckBox Color Picker Combo Box Drop Down Flyout Anchor Insert Table Label Menu Menu Section MRU Split Menu Spinner Split Button Textbox Toggle Button
  • 20. control displays DisplayMode Display modes listed are not available for all controls.
  • 21. What makes up a ribbon? Ribbon XML Defines the tabs, groups, controls, rendering templates JavaScript CommandUIHandler or a custom Page Component Handles populating Dropdowns, on click events, etc Delegate Control One approach to getting your custom JavaScript loaded into the page Note: Any method of getting your JavaScript into the page is fine
  • 22. RIBBON XML CommandUIExtension CommandUIDefinition CommandUIHandlers
  • 23. RIBBON XML CommandUIExtension CommandUIDefinition
  • 24. RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Tab
  • 25. RIBBON XML CommandUIExtension CommandUIDefinition Tab
  • 26. RIBBON XML CommandUIExtension GroupId CommandUIDefinition Tab Scaling Groups MaxSize Group Controls Scale Etc Button DropDown MaxSize Scale Group Controls Etc Button DropDown GroupId
  • 27. RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Tab
  • 28. RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate
  • 29. RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Layout Section Row ControlRef ControlRef Row ControlRef ControlRef Section
  • 30. RIBBON XML CommandUIExtension CommandUIDefinition GroupTemplate Tab
  • 31. RIBBON XML CommandUIExtension Template Id CommandUIDefinition GroupTemplate Tab Layout Groups Section Group Row Controls ControlRef ControlRef Button DropDown TemplateAlias Scaling MaxSize Scale Size
  • 32. RIBBON XML CommandUIExtension CommandUIDefinition CommandUIHandlers
  • 33. RIBBON XML CommandUIExtension CommandUIHandlers
  • 34. RIBBON XML CommandUIExtension CommandUIHandlers Two attributes: Command, CommandAction Command is a unique identifier CommandAction is JavaScript, URL or anything that was previously used in an UrlAction CommandUIHandler CommandUIHandler CommandUIHandler CommandUIHandler CommandUIHandler
  • 35. RIBBON XML CommandUIExtension CommandUIHandlers CommandUIDefinition
  • 36. RIBBON XML CommandUIExtension CommandUIHandlers CommandUIDefinition CommandUIHandler Tab Groups CommandUIHandler Group CommandUIHandler Controls Button DropDown Group Command Id Controls Button DropDown
  • 37. Command UI Handler Maps a control to set of JavaScript Very powerful when coupled with the Client OM Example <Button Id=“ButtonId" Command=“ButtonCommand“ … /> <CommandUIHandler Command=“ButtonCommand“ CommandAction="javascript: SP.UI.Notify.addNotification(‘Button was clicked');"/>
  • 38. Page Component JavaScript class that serves as the middle man between the Ribbon and your customization Uses a structured contract that the Ribbon understands
  • 39. Page Component (cont) Create your custom page component class Register your namespace Register your class to inherit from CUI.Page.PageComponent Initialize the page component CP.SharePoint.RibbonExample.PageComponent.initializePageComponent = function () { varribbonPageManager= SP.Ribbon.PageManager.get_instance(); if (null !== ribbonPageManager) { ribbonPageManager.addPageComponent(CP.SharePoint.RibbonExample.PageComponent.instance); } }
  • 40. Delegate Control Load SharePoint Prerequisites <SharePoint:ScriptLinkName="SP.js" runat="server" LoadAfterUI="true” … /> <SharePoint:ScriptLink Name="CUI.js" runat="server" LoadAfterUI="true" … /> Load Custom JavaScript <SharePoint:ScriptLink Name="/_layouts/RibbonExample/sp.ui.RibbonExample.js" runat="server" LoadAfterUI="true“ … /> Initialize Our Page Component <script type="text/javascript"> //<![CDATA[ function initializeRibbonExample() { CP.SharePoint.RibbonExample.PageComponent.initialize(); } ExecuteOrDelayUntilScriptLoaded(initializeRibbonExample, 'sp.ui.RibbonExample.js'); //]]> </script>
  • 41. Getting current Context Get List of Selected Items // Returns a collection of item ids varctx = SP.ClientContext.get_current(); varitems = SP.ListOperation.Selection.getSelectedItems(ctx); Get Selected List // Returns a guid SP.ListOperation.Selection.getSelectedList()
  • 43. resources XML file defining all OOTB Ribbons C:rogram filesommon filesicrosoft Sharedeb Server Extensions4EMPLATELOBALMLMDUI.xml MSDN Resources http://msdn.microsoft.com/en-us/library/ee540027.aspx http://msdn.microsoft.com/en-us/library/ee539395.aspx http://msdn.microsoft.com/en-us/library/ff407303.aspx Community Resources http://www.sharepointnutsandbolts.com/2010/01/customizing-ribbon-part-1-creating-tabs.html http://blogs.msdn.com/b/jfrost/archive/2009/11/08/how-to-display-a-sharepoint-dialog-from-ribbon-button-and-get-selected-item-context.aspx http://blogs.msdn.com/b/vesku/archive/2010/02/25/how-to-sharepoint-2010-js-client-object-model-and-ui-advancements.aspx

Editor's Notes

  1. * Important aspect of the ribbon. Controls should never move or be hidden.