【发布时间】:2016-03-03 16:05:51
【问题描述】:
我创建了一个 SP 托管应用程序。然后我添加了一个功能区自定义操作并选择了“Host Web”
我添加了以下 XML:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="cautionIcon"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<!--
Update the UI definitions below with the controls and the command actions
that you want to enable for the custom action.
-->
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.EditingTools.CPInsert.Groups._children">
<Group
Id="UploadLinkRibbonActionGroup"
Sequence="80"
Description="This group will contain the Button control"
Title="Caution"
Template="Ribbon.Templates.Flexible2">
<Controls Id="UploadLinkControl">
<Button
Id="CautionButton"
Command="UploadLinkButtonCommand"
Image32by32="/sites/insightdeveloper/PublishingImages/mrT32.png"
LabelText="Caution"
TemplateAlias="o1"
Sequence="10"/>
</Controls>
</Group>
</CommandUIDefinition>
<CommandUIDefinition
Location="Ribbon.EditingTools.CPInsert.Scaling._children">
<MaxSize
Id="CustomEditRibbonActionsOneMaxSize"
Sequence="15"
GroupId="UploadLinkRibbonActionGroup"
Size="LargeLarge"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="UploadLinkButtonCommand"
CommandAction="~appWebUrl/Pages/Default.aspx?{StandardTokens}"/>
</CommandUIHandlers>
</CommandUIExtension >
这确实为我的功能区添加了一个按钮。
问题是我无法在 CommandAction= 中更改 ~appWebUrl 后立即调用任何自定义 JS 我在尝试部署时遇到错误。 “验证应用程序包时出错”。
我希望能够在命令操作“javascript:alert('hello');”上添加一些 JS但是一旦 ~appWebUrl 丢失,我就会收到错误消息。 SP 2010 没有这个问题,这很容易。
感谢任何帮助!
【问题讨论】:
标签: sharepoint office365