Scenario:
We wanted to extend the Ribbon to have a Print button for Custom list with Infopath form.
While I found so many articles to extend Ribbon UI, most of them are for a regular list / library. In SP2010, now we do have an option to use a Infopath for a custom list which uses a brand new Ribbon Tab/Grouping and I found nothing much on Web.
Solution:
Use the following Element manifest.
Code:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="InfopathformPrintButton" Location="CommandUI.Ribbon" Rights="ViewListItems"> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.Tabs.InfoPathListDisplayTab.Manage.Controls._children"> <Button Id="Ribbon.Tabs.InfoPathListDisplayTab.Manage.Controls.Print" Command="CallPrint" Sequence="1" Description="Print the infopath form" Image16by16="/_layouts/images/placeholder32x32.png" Image32by32="/_layouts/images/placeholder32x32.png" LabelText="Print" TemplateAlias="o1"/> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="CallPrint" CommandAction="javascript:function processPrint(){window.print()};processPrint();" /> </CommandUIHandlers> </CommandUIExtension> </CustomAction> </Elements>
5 comments:
Could you be more specific on how to use it?
I need it badly.
Can you explain how to use the code?
I need it badly.
Can you explain how to use this code?
I need it badly
Simran its a Element Manifest file.
So create a feature and include this Element.xml file. Once you activate this feature , it will show up
How to use it for New Item
Post a Comment