Office.AddinCommands.Source interface

Kapselt Quelldaten für Add-In-Ereignisse.

Hinweise

Informationen zur Unterstützung in Excel, Word und PowerPoint finden Sie unter Anforderungssätze für Add-In-Befehle.

Im Folgenden werden Supportinformationen für Outlook beschrieben.

[ API-Satz: Postfach 1.3 ]

Weitere Supportinformationen finden Sie unter Anforderungssätze für Add-In-Befehle .

Mindestberechtigungsstufe (Outlook): eingeschränkt

Anwendbarer Outlook-Modus: Verfassen oder Lesen

Eigenschaften

id

Die ID des Steuerelements, das den Aufruf dieser Funktion ausgelöst hat. Die ID stammt aus dem Manifest.

Details zur Eigenschaft

id

Die ID des Steuerelements, das den Aufruf dieser Funktion ausgelöst hat. Die ID stammt aus dem Manifest.

id: string;

Eigenschaftswert

string

Hinweise

Im Folgenden werden Supportinformationen für Outlook beschrieben.

[ API-Satz: Postfach 1.3 ]

Weitere Supportinformationen finden Sie unter Anforderungssätze für Add-In-Befehle .

Mindestberechtigungsstufe (Outlook): eingeschränkt

Anwendbarer Outlook-Modus: Verfassen oder Lesen

Beispiele

// In this example, consider a button defined in an add-in manifest.
// The following is the XML manifest definition. Below it is the Teams 
// manifest (preview) definition.
//
//<Control xsi:type="Button" id="eventTestButton">
//    <Label resid="eventButtonLabel" />
//    <Tooltip resid="eventButtonTooltip" />
//    <Supertip>
//        <Title resid="eventSuperTipTitle" />
//        <Description resid="eventSuperTipDescription" />
//    </Supertip>
//    <Icon>
//        <bt:Image size="16" resid="blue-icon-16" />
//        <bt:Image size="32" resid="blue-icon-32" />
//        <bt:Image size="80" resid="blue-icon-80" />
//    </Icon>
//    <Action xsi:type="ExecuteFunction">
//        <FunctionName>testEventObject</FunctionName>
//    </Action>
//</Control>
//
// The Teams manifest (preview) definition is the following.
// Ellipses("...") indicate omitted properties.
//
//     "extensions": [
//         {
//             ...
//             "runtimes": [
//                 {
//                  "id": "CommandsRuntime",
//                  "type": "general",
//                  "code": {
//                      "page": "https://localhost:3000/commands.html",
//                      "script": "https://localhost:3000/commands.js"
//                  },
//                  "lifetime": "short",
//                  "actions": [
//                      {
//                          "id": "testEventObject",
//                          "type": "executeFunction",
//                          "displayName": "testEventObject"
//                      }
//                  ]
//              }
//             ],
//             "ribbons": [
//                 {
//                     ...
//                     "tabs": [
//                         ...
//                         "groups": [
//                             ...
//                             "controls": [
//                                 {
//                                      "id": "eventTestButton",
//                                      "type": "button",
//                                      "label": "Perform an action",
//                                      "icons": [
//                                          {
//                                              "size": 16,
//                                              "file": "https://localhost:3000/assets/blue-icon-16.png"
//                                          },
//                                          {
//                                              "size": 32,
//                                              "file": "https://localhost:3000/assets/blue-icon-32.png"
//                                          },
//                                          {
//                                              "size": 80,
//                                              "file": "https://localhost:3000/assets/blue-icon-80.png"
//                                          }
//                                      ],
//                                      "supertip": {
//                                          "title": "Perform an action",
//                                          "description": "Perform an action when clicked."
//                                      },
//                                      "actionId": "testEventObject"
//                                  }
//                             ]
//                         ]
//                     ]                           
//                 }
//             ]
//         }
//     ]


// The button has an id set to "eventTestButton", and will invoke
// the testEventObject function defined in the add-in.
// That function looks like this:
function testEventObject(event) {
    // The event object implements the Event interface.

    // This value will be "eventTestButton".
    const buttonId = event.source.id;

    // Signal to the host app that processing is complete.
    event.completed();
}
// Function is used by two buttons:
// button1 and button2
function multiButton (event) {
    // Check which button was clicked.
    const buttonId = event.source.id;

    if (buttonId === 'button1') {
        doButton1Action();
    } else {
        doButton2Action();
    }

    event.completed();
}