2010-10-14 42 views
0

將新的自定義按鈕添加到功能區時遇到一些問題。如sharepoint 2010 SDK(如何:修改用戶界面使用自定義操作)中所述,我創建了一個Visual Studio項目並複製了應創建新按鈕的xml代碼。下面是代碼:SP2010:如何在功能區中創建新按鈕

<?xml version="1.0" encoding="utf-8"?> 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
    <CustomAction Id="ListViewCustomization" Location="CommandUI.Ribbon.ListView" RegistrationId="101" RegistrationType="List" Title="List View Ribbon Customization"> 
    <CommandUIExtension> 
     <CommandUIDefinitions> 
     <CommandUIDefinition Location="Ribbon.Documents.Share.Controls._children"> 
      <Button Id="ListViewButton" Command="ListViewButtonCommand" Description="Go to Settings" LabelText="Site Settings" TemplateAlias="o2" Sequence="93"/> 
     </CommandUIDefinition> 
     </CommandUIDefinitions> 
     <CommandUIHandlers> 
     <CommandUIHandler Command="ListViewButtonCommand" CommandAction="/_layouts/settings.aspx" /> 
     </CommandUIHandlers> 
    </CommandUIExtension> 
    </CustomAction> 
</Elements> 

我檢查了我的網站集的站點設置,以及新功能的結果被激活,但周圍沒有新的按鈕。 我錯過了一些步驟?

回答

1

如果我遵循的步驟,我看到在「共享&跟蹤」組中的功能區按鈕。

我希望你正在檢查一個文檔庫,而不是其他地方。請記住,您只通過在xml文件中指定RegistrationId =「101」來定製文檔庫。

+0

聖牛你是對的,那個按鈕就在那裏!顯然,我不是在看一個文檔庫,而是在一個列表中(因爲標題是「向LIST表單添加一個按鈕」)。那麼我該如何將該按鈕添加到列表選項卡?我需要什麼RegistrationId? – Maik 2010-10-14 14:02:07

+0

@Maik SharePoint列表模板ID http://sharepointkb.wordpress.com/2008/08/26/sharepoint-list-template-ids-registrationids-list-template-type-ids/ – 2010-10-14 14:16:30

+0

實際上,該ID代表列表模板ID。因此,這取決於您是使用自定義列表模板(在這種情況下,您將擁有自己的ID),還是使用現有列表模板之一創建列表。如果您從現有列表模板創建列表,則需要查找列表模板的列表模板標識。檢查Sharepoint SDK中的「ListTemplateType Enumeration」 – 2010-10-14 14:16:34