Donnerstag, 7. Juli 2011

Add customaction to ribbonbar in sharepoint 2010 wiki page

Just a simple copy & paste of a custom action that adds a button to the ribbonbar in a publishingpage in the pageslist of a wiki-site:

<CustomAction Id="WikiDocumentExportCustomizationPageView" Rights="Contribute" Location="CommandUI.Ribbon" Sequence="30" Title="Wiki-Document-Export"> 
 <CommandUIExtension> 
  <CommandUIDefinitions> 
   <CommandUIDefinition Location="Ribbon.WikiPageTab.Share.Controls._children"> 
    <Button Id="WikiDocumentExportCustomizationPageView.Button" Command="ExportCurrentWikiDocumentFile2" CommandType="General" Description="Export Wiki-Document" TemplateAlias="o1" Sequence="30" Image32by32="/_layouts/images/wiki/pdf_export.png" LabelText="Export Wiki-Document"/> 
   </CommandUIDefinition> 
  </CommandUIDefinitions> 
  <CommandUIHandlers> 
   <CommandUIHandler Command="ExportCurrentWikiDocumentFile2" CommandAction="javascript:ExportCurrentWikiDocumentFile('{SiteUrl}');"/>
  </CommandUIHandlers> 
 </CommandUIExtension> 
</CustomAction>

Pay attention that this button is only visible to users with contribute-rights on the list.
ExportCurrentWikiDocumentFile is a custom external javascript-function that implements the code behind the button. You must define your own function here...