lundi 23 février 2015

XML For New Custom Action



I am trying to add a custom action button to a tab on the ribbon.


I have the following XML in an elements.xml file in Visual Studio:



<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://ift.tt/sQmbje">
<CustomAction
Description="CREATE NEW ITEM"
Title="CREATE ITEM"
Id="{53801DF2-A778-4E93-8191-ACBC06C7D4DD}"
Location="ViewToolbar"
RegistrationType="ContentType"
RegistrationId="0x010014D754C688D12A4FB4C811B4B4F67A5C"
Sequence="0"
Rights="ViewListItems"
xmlns="http://ift.tt/sQmbje">
<CommandUIExtension xmlns="http://ift.tt/sQmbje">
<!-- Define the (UI) button to be used for this custom action -->
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListForm.Display.Manage.Controls._children">
<Button Id="{10C2173C-537F-4D3D-8394-9ADB8486CEBE}"
Command="{99AAAD72-4AB6-4EC0-8B5A-E3F194145A4D}"
Image32by32="~site/_layouts/Images/MYSOLUTION/Create32.png"
Image16by16="~site/_layouts/Images/MYSOLUTION/Create16.png"
Sequence="0"
LabelText="CREATE ITEM"
Description="CREATE NEW ITEM"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<!-- Define the action expected on the button click -->
<CommandUIHandler Command="{99AAAD72-4AB6-4EC0-8B5A-E3F194145A4D}" CommandAction="~site/_layouts/MYSOLUTION/mysolutionpage.aspx?List={ListId}&amp;ID={ItemId}" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>


But all that appears is the following:


enter image description here


And the button does not work when I click it.


How can I get the tab to display the correct name and the button to work when clicked?


Is it possible to have this XML automatically generated?








0 commentaires:

Enregistrer un commentaire