SharePoint 2010 で CustomAction を使用してリボン アイテムを追加する方法
12387 次
2 に答える
3
このブログ シリーズをお勧めします: http://www.sharepointnutsandbolts.com/2010/01/customizing-ribbon-part-1-creating-tabs.html
于 2012-10-22T13:14:06.000 に答える
3
以下は、SharePoint 2010 で CustomAction を使用して、TemplateType = 10003 のリストに「Test Action 1」というリボン アイテム (ボタン) を追加する手順です。
1.新しい要素を追加し、次のコードを追加します。2 つの CustomActions があることに注意してください。1 つはリボン ボタンを追加し、もう 1 つは JavaScript ファイルを追加します。
RegistrationId は ListTemplateType と同じです。
既定のサーバー リボン カスタマイズの場所の一覧については、この記事を参照してください。
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction ShowInLists="TRUE" Id="TestAction1" RegistrationType="List" RegistrationId="10003" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
<Button Id="Ribbon.ListItem.Actions.TestAction1" Alt="Test Action 1" Sequence="10" Image32by32="/_layouts/images/ACTIONSEDITPAGE.PNG" Command="Test_Action1" LabelText="Test Action 1" TemplateAlias="o2"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="Test_Action1" CommandAction="javascript:TestAction1();" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Test.Ribbon.TestScript" Location="ScriptLink" ScriptSrc="~/_layouts/SPTest/TestJScript1.js" />
</Elements>
2.Layouts フォルダーをマップし、TestJScript1.js ファイルを追加します。
function TestAction1() {
alert("This the test action 1");
}
サンプル プロジェクトの構造を参照してください
于 2012-10-22T23:48:29.770 に答える