{ItemId} is null in SharePoint Custom Ribbon Action
As the title says, the {ItemId} is null for the code listed below. I read on a blog that the tokens may not be implemented in the Custom Ribbon Action. Can anyone confirm this?
Please take a look at my Elements.xml file below:
<?xml version="1.0" encoding="utf-8"?>
开发者_JAVA技巧<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction ScriptSrc="ADBTicketing/scripts/CustomActions.js" Location="ScriptLink" RegistrationType="List" RegistrationId="12000"></CustomAction>
<CustomAction Id="Ribbon.ListItem.Manage.AddAButton.ADBServices.EmailStatus"
Location="CommandUI.Ribbon" RegistrationType="List" RegistrationId="12000">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Manage.Controls._children">
<Button Id="Ribbon.ListItem.Manage.ADBServices.EmailStatus"
Command="EmailStatusOfItem"
Image32by32="/_layouts/Images/ADBTicketing/EmailClient.png"
LabelText="E-mail Status"
Sequence="21"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="EmailStatusOfItem"
CommandAction="javascript:addCommentToTicket({ItemId});"></CommandUIHandler>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
Thanks, Joshua
In the View Ribbon use
SelectedItemId
instead of
ItemId
You can use it in CommandAction, but not in EnabledScript as I'm finding out...
So for yours to work you pass to javascript and surround with single quotes as: CommandAction="javascript:addCommentToTicket('{ItemId}');"
精彩评论