Skip to content

Page Operations

Amit Shuster edited this page Jan 24, 2021 · 6 revisions
ℹ️ This wiki has been deprecated
All our Client APIs documentation and references can be found in the new Power BI embedded analytics Client APIs documentation set.
For the content of this article see Add or delete a report page.

With page operations API you can add and delete pages from a report during an embed session.

Add Page

Add a new page to the report.

Definition

/**
* @param displayName - set the display name for the new page.
*                      If not specified the display name would be Page#<NUM>
* @returns {Promise<Page>}
*/
addPage(displayName?: string): Promise<Page>;

The function returns a Page instance of the created page.

Code samples

report.addPage("Sales").then((newPage) => {
    ...
});

Delete Page

Delete a page from the report

Definition

Using a report instance:

/**
* @param pageName - pageName is a unique identifier that's different
*                   from the display name and can be acquired from the getPages API
* @returns {Promise<void>}
*/
deletePage(pageName: string): Promise<void>;

Using a page instance:

/**
* @returns {Promise<void>}
*/
delete(): Promise<void>;

The returned value is resolved after the page is deleted.

Code samples

Using a report instance:

report.deletePage("ReportSection42a34dd163bc0cd05980").then(() => {
    // "ReportSection42a34dd163bc0cd05980" is an example for a pageName taken from the getPages API
    ...
});

Using a page instance:

newPage.delete();

Limitations

Page operations will work only after the report is loaded.