Office.EnhancedLocationsChangedEventArgs interface

在引发事件时 Office.EventType.EnhancedLocationsChanged 提供当前增强的位置。

注解

[ API set: Mailbox 1.8 ]

示例

// Adds an event handler for the EnhancedLocationsChanged event.
Office.onReady(() => {
    document.addEventListener('DOMContentLoaded', () => {
        // Get a reference to the mailbox and use it to add an event handler.
        const mailbox = Office.context.mailbox;
        mailbox.addHandlerAsync(Office.EventType.EnhancedLocationsChanged, enhancedLocationsChangedHandler, (result) => {
            if (result.status === Office.AsyncResultStatus.Failed) {
                console.error(`Failed to add event handler: ${asyncResult.error.message}`);
                return;
            }

            console.log("Event handler added successfully.");
        });
    });
});

// Handles the EnhancedLocationsChanged event.
function enhancedLocationsChangedHandler(event) {
    console.log(`Event: ${event.type}`);
    const enhancedLocations = event.enhancedLocations;
    enhancedLocations.forEach((location) => {
        console.log(`Display name: ${location.displayName}`);
        const locationType = location.locationIdentifier.type;
        console.log(`Type: ${locationType}`);
        if (locationType === Office.MailboxEnums.LocationType.Room) {
            console.log(`Email address: ${location.emailAddress}`);
        }
    });
}

属性

enhancedLocations

获取增强的位置集。

type

获取事件的类型。 有关详细信息,请参阅 Office.EventType

属性详细信息

enhancedLocations

获取增强的位置集。

enhancedLocations: LocationDetails[];

属性值

注解

[ API set: Mailbox 1.8 ]

type

获取事件的类型。 有关详细信息,请参阅 Office.EventType

type: "olkEnhancedLocationsChanged";

属性值

"olkEnhancedLocationsChanged"

注解

[ API set: Mailbox 1.8 ]