2012-10-22 3 views

답변

3

다음은에 "테스트 조치 1"이라는 리본 항목 (버튼)를 추가하는 단계입니다 SharePoint 2010의 CustomAction을 사용하여 TemplateType = 10003의 목록

1. 새 요소를 추가하고 다음 코드를 추가하십시오. 두 가지 CustomActions가 있습니다. 하나는 리본 버튼을 추가하고 다른 하나는 자바 스크립트 파일을 추가하는 것입니다.

RegistrationId는 ListTemplateType과 동일합니다.

기본 서버 리본 사용자 지정 위치 목록을 보려면 this article을 참조하십시오.

<?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. 레이아웃 폴더를 매핑하고 TestJScript1.js 파일을 추가하십시오.

function TestAction1() { 
    alert("This the test action 1"); 
} 

샘플 프로젝트 구조를 참조

Sample Solution Explorer view

관련 문제