在新功能区中更改Sharepoint图标

时间:2019-03-20 18:51:51

标签: sharepoint ribbon

正在尝试在项目服务器站点中添加功能区,并且该功能正常,但是我目前正在寻找一种更改图标的方法

这是我使用的代码:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="d6e0a4c1-19a9-4846-92fb-d0593aa3bbfc.myAppNewFormAction"
                RegistrationType="List"
                RegistrationId="115"
                Location="CommandUI.Ribbon"
                Sequence="10001"
                Title="New myApp Form">
    <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.Documents.New.Controls._children">
          <Button Id="Ribbon.Documents.New.myAppNewFormActionButton"
                  Alt="New myApp Form"
                  Sequence="100"
                  Command="Invoke_myAppNewFormActionButtonRequest"
                  LabelText="New myApp Form"
                  TemplateAlias="o1"
                  Image32by32="Mysite/Pwa/ImageFolders/myAppLogoBug-onwhite-32.png"
                  Image16by16="Mysite/Pwa/ImageFolders/myAppLogoBug-onwhite-16.png" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="Invoke_myAppNewFormActionButtonRequest"
                          CommandAction="~appWebUrl/Pages/Default.aspx?Action=New&amp;Source={Source}&amp;ListURLDir={ListUrlDir}"/>
      </CommandUIHandlers>
    </CommandUIExtension >
  </CustomAction>
</Elements>

因此在我的项目服务器上;我创建了一个列表,其中存储了我的图像,但是它不起作用,该图标显示了一个空的情况

我也尝试在base 64中转换图像,但结果是相同的:/

有什么想法我做错了吗?

1 个答案:

答案 0 :(得分:0)

我的测试演示供您参考。

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="cfe1a724-53ea-4a66-acda-7bc69c2fff1c.CustomRibbonImage"
                RegistrationType="List"
                RegistrationId="{$ListId:OOBDoc;}"
                Location="CommandUI.Ribbon"
                Sequence="10001"
                Title="Invoke &apos;CustomRibbonImage&apos; action">
    <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.Documents.New.Controls._children">
          <Button Id="Ribbon.Documents.New.CustomRibbonImageButton"
                  Alt="Request CustomRibbonImage"
                  Sequence="100"
                  Command="Invoke_CustomRibbonImageButtonRequest"
                  LabelText="Request CustomRibbonImage"
                  TemplateAlias="o1"
                  Image32by32="~sitecollection/SiteAssets/test.png"
                  Image16by16="~sitecollection/SiteAssets/test.png" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="Invoke_CustomRibbonImageButtonRequest"
                          CommandAction="~appWebUrl/Pages/Default.aspx?{StandardTokens}&amp;SPListItemId={SelectedItemId}&amp;SPListId={SelectedListId}"/>
      </CommandUIHandlers>
    </CommandUIExtension >
  </CustomAction>
</Elements>

enter image description here