2017-05-28 7 views
0

Wenn Sie Elemente zu einem Kontextmenü (Multifunktionsleiste) in einem VSTO Outlook-Add-In (für Outlook 2009) hinzufügen, gibt es eine Möglichkeit, dasselbe Kontextmenü für mehrere IDMso (dh ich möchte die gleichen Elemente hinzufügen, wenn einzelne oder mehrere E-Mails ausgewählt sind)? Ich habe versucht, das XML unten, aber das Schema mag nicht, dass ich die gleiche Schaltfläche ID an mehreren Orten wiederverwenden.Wiederverwendung des gleichen contextMenu XML für ContextMenuMailItem und ContextMenuMultipleItems

<?xml version="1.0" encoding="UTF-8"?> 
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"> 
    <contextMenus> 
    <contextMenu idMso="ContextMenuMailItem"> 
     <button id="DoThis" 
      label="Label" 
      onAction="DoThis" 
      getVisible="GetVisible"/> 
    </contextMenu> 
    <contextMenu idMso="ContextMenuMultipleItems"> 
     <button id="DoThis" 
      label="Label" 
      onAction="DoThis" 
      getVisible="GetVisible"/> 
    </contextMenu> 
    </contextMenus> 
</customUI> 

Idealer ich denke, ich so etwas wie dies möchte:

<?xml version="1.0" encoding="UTF-8"?> 
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"> 
    <contextMenus> 
    <contextMenu idMso="ContextMenuMailItem,ContextMenuMultipleItems"> 
     <button id="DoThis" 
      label="Label" 
      onAction="DoThis" 
      getVisible="GetVisible"/> 
    </contextMenu> 
    </contextMenus> 
</customUI> 

Antwort

1

Weiternutzung id Attribut nicht möglich ist, aber es ist ein weiteres Attribut, das wiederverwendbar ist - tag:

<button id="DoThis1" tag="DoThis" ... /> 
<button id="DoThis2" tag="DoThis" /> 

Dann in dem Code dann können Sie den Befehl nicht durch Id, sondern durch Tag Eigenschaft der Kontrolle bestimmen.

Verwandte Themen