Can't Open “Wiki page” in SharePoint Dialog Box SharePoint Online
-
17-01-2021 - |
Pergunta
Here is the code that I am using
function openDialog(pageUrl,title) {
console.log(pageUrl+title);
var tempTitle= title.replace(/%20/g,' ');
SP.UI.ModalDialog.showModalDialog(
{
url: pageUrl,
title: tempTitle
}
);
}
Solução
The SP.UI.ModalDialog.showModalDialog(options) method only works with a Web Part page. It does not work with a Wiki page.
If you try with a Wiki page URL as the URL of the page that appears in the modal dialog, you will get the “Sorry, something went wrong. An unexpected error has occurred” error in UI.
If you check the log, you will find the following error message:
The Ribbon Tab with id: "Ribbon.Read" has not been made available for this page or does not exist.
You need to use a Web Part page in SP.UI.ModalDialog.showModalDialog(options) instead.
openDialog(<webPartPageUrl>,title)
Here are some threads with the same issue for your reference (also apply to SPO):
How can I display a Wiki Page in a Pop Up Dialog?
The Ribbon Tab with id: "Ribbon.Read" has not been made available for this page or does not exist