2017-05-28 23 views
0

VSTO Outlookアドイン(Outlook 2009+の場合)のコンテキストメニュー(リボン)に項目を追加する場合、複数のidMsoに同じコンテキストメニューを使用する方法がありますつまり、1つまたは複数の電子メールが選択されたときに同じアイテムを追加したいのですが)私は下のXMLを試しましたが、スキーマは私が同じボタンIDを複数の場所で再使用しているのを好きではありません。ContextMenuMailItemとContextMenuMultipleItemsの同じcontextMenu xmlの再利用

<?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> 

理想的には私はこのような何かたいと思います:id属性を再利用

<?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> 

答えて

1

はできませんが、再利用可能である別の属性がある - tagは:

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

その後、コードでは、Idではなく、コントロールのTagプロパティでコマンドを判断することができます。

関連する問題