Edit

Excel.LinkedEntityDataDomainRefreshMode enum

Represents the refresh mode setting for the LinkedEntityCellValue objects of a LinkedEntityDataDomain.

Remarks

API set: ExcelApi 1.19

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-linked-entities.yaml

// Register the product, category, and supplier data sources with Excel.
await Excel.run(async (context) => {
    const domains: Excel.LinkedEntityDataDomainCollection = context.workbook.linkedEntityDataDomains;
    const refreshModes: Excel.LinkedEntityDataDomainRefreshMode[] = [
        Excel.LinkedEntityDataDomainRefreshMode.manual,
        Excel.LinkedEntityDataDomainRefreshMode.onLoad,
        Excel.LinkedEntityDataDomainRefreshMode.periodic
    ];
    // Script Lab prefixes the function ID with the companion sample's name, without spaces.
    const loadFunctionId = "LINKEDENTITYLOADSERVICE.CONTOSOLOADSERVICE";
    const options: Excel.LinkedEntityDataDomainCreateOptions[] = [
        {
            dataProvider: "Contoso",
            id: "products",
            name: "Products",
            loadFunctionId,
            periodicRefreshInterval: 300,
            supportedRefreshModes: refreshModes
        },
        {
            dataProvider: "Contoso",
            id: "categories",
            name: "Categories",
            loadFunctionId,
            periodicRefreshInterval: 300,
            supportedRefreshModes: refreshModes
        },
        {
            dataProvider: "Contoso",
            id: "suppliers",
            name: "Suppliers",
            loadFunctionId
        }
    ];

    // Replace only this sample's domains so registration is repeatable.
    const existingDomains: Excel.LinkedEntityDataDomain[] = options.map((options) =>
        domains.getItemOrNullObject(options.id)
    );
    await context.sync();
    existingDomains.forEach((domain) => {
        if (!domain.isNullObject) {
            domain.delete();
        }
    });
    options.forEach((options) => domains.add(options));
    await context.sync();
    console.log("Registered Products, Categories, and Suppliers. Manual refresh is the default.");
});

Fields

manual = "Manual"

Manual refresh by the user. Refresh is not triggered automatically.

onLoad = "OnLoad"

Refresh on workbook load, applicable to linked entity data domains defined by service data providers, such as Bing or Power BI. Refresh on add-in load, applicable to linked entity data domains defined by Office Add-ins.

periodic = "Periodic"

Refresh automatically based on the frequency, in seconds, specified by periodicRefreshInterval. For linked entity data domains defined by service data providers, such as Bing or Power BI, this value also initiates a refresh each time the workbook is opened. For linked entity data domains defined by Office Add-ins, this value also initiates a refresh each time the add-in loads.

unknown = "Unknown"

Refresh mode is unknown or unsupported.