How to use the Advanced Embed API

Last update:

Audience: Developers building Sapho micro apps

Sapho supports embedding the Sapho Home App or any individual Sapho micro app in a web page or intranet, such as SharePoint. For this purpose, Sapho provides 2 APIs - Sapho.run and Sapho.reload.

Sapho.run(options)

Embeds the Sapho Home App or any individual Sapho micro app in a page as an iframe and returns the id of the iframe created (or used).

The API accepts the following properties in the options object:

Name Description
id Optional. Allows setting the id attribute of the inserted iframe element. When there is already an iframe with this id in the document, the existing id is used and a new iframe is not created. When this property is omitted, a uniquely generated value will be used.
url Required for Web Embed with Login and SharePoint Online. The full URL of your Sapho instance.
page Optional. The title of the page to be loaded. Defaults to the micro app’s Start Page.
hideHeader Optional. Set to 1 to hide the header in the embedded micro app.
hideButtonbar Optional. Set to 1 to hide the default button bar in the embedded micro app.
height Optional. The value of iframe’s height in pixels. Defaults to 600 when a new iframe is created.
width Optional. The value of iframe’s width in pixels. Defaults to 600 when a new iframe is created.
border Optional. The width of iframe's border in pixels. Defaults to 0 when a new iframe is created.
borderColor Optional. The color of iframe's border in CSS syntax. Defaults to black when a new iframe is created.
sso Required for SharePoint Online only. When the app is using an Azure Active Directory security provider and the parameter is set to 1, users will be logged in the app through single sign-on.

Sapho.reload(options)

Reloads the existing embedded Sapho page.

The API accepts the following properties in the options object:

Name Description
id Required. The id of the existing Sapho iframe (returned by the previous Sapho.run({...}) call).
page Optional. The title of the page to be loaded. Defaults to the previously specified page.
hideHeader Optional. Set to 1 to hide the header in the embedded micro app. Defaults to the previously specified value.