Last Update: 9/26/2016

HostDialogService

This API is in private preview and subject to change.

Class which manages showing dialogs in the parent frame

Example

    VSS.getService(VSS.ServiceIds.Dialog).then(function(dialogService) {
        var extensionCtx = VSS.getExtensionContext();
        // Build absolute contribution ID for dialogContent
        var contributionId = extensionCtx.publisherId + "." + extensionCtx.extensionId + ".dialogContent";

        // Show dialog
        var dialogOptions = {
            title: "My Dialog Title",
            width: 800,
            height: 600
        };

        dialogService.openDialog(contributionId, dialogOptions);
    });

See Using host dialog for additional samples.

Methods

openDialog()

Open a modal dialog in the host frame which will get its content from a contributed control.

Syntax

 IPromise<IExternalDialog> openDialog(contributionId, dialogOptions, contributionConfig, postContent)

Parameters

  • contributionId: string. The ID of the control contribution to host in the dialog
  • dialogOptions: IHostDialogOptions. options.title - title of dialog
  • contributionConfig: Object. Optional. Initial configuration to pass to the contribution control.
  • postContent: Object. Optional. Optional data to post to the contribution endpoint. If not specified, a GET request will be performed.

Returns

openMessageDialog()

Open a modal dialog in the host frame which will display the supplied message.

Syntax

 IPromise<IMessageDialogResult> openMessageDialog(message, options)

Parameters

  • message: string or JQuery. the message to display in the dialog. If it's a string, the message is displayed as plain text (no html). For HTML display, pass in a jQuery object.
  • options: IOpenMessageDialogOptions. Optional.

Returns