Posts mit dem Label Custom Action werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Custom Action werden angezeigt. Alle Posts anzeigen

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...

Montag, 2. Mai 2011

CustomAction in ribbonbar doesn't appear for contenttype

Recently I wanted to add a contenttype-specific custom action to the ribbonbar of a document-library. But the button didn't appear. After a short time of verifying and comparing IDs with SharePoint manager, I found the issue:

GuidGen in Visual Studio created me this GUID: 717EE0C46890438e8E245E7D4B4B7438 which I used for the sitecontenttype inheriting from document (0x010100). Then the list instance creates a listcontenttype from this and appends its own GUID. But the ID from the listcontenttype is 0x010100717EE0C46890438E8E245E7D4B4B743800E57C8E7D4D7D024C9A357907E925F14B.

So what's the difference between the root? Its the lower case character 'e'. It seems as if SharePoint would have a problem with case-sensitivity. Since I changed the lower 'e' to an upper 'E' in my sitecontenttype and customaction, the button is visible now.

So please pay attention for lower case characters and replace them when generating Guids with VisualStudio GuidGen.

Donnerstag, 30. Juli 2009

Listeninstanzen - Cannot complete this action

Werden bei einer Solution ListInstances verwendet und sollen dann an speziell diese Listen CustomActions angehängt werden, empfiehlt es sich, anstelle der Standard-TemplateTypes (100, 101, etc..) eigene IDs ab 10000 zu verwenden.

Diese Änderung muss aber überall nachgezogen werden, sonst kommt es beim Erstellen der SiteCollection schnell zu der nichts sagenden Fehlermeldung "Cannot complete this action".



Die TemplateType-ID muss angepasst werden in
  • CustomAction
  • ListInstance
  • ListTemplate
  • Schema.xml