我在共享点页面上的应用程序部分点击按钮时调用功能'Dialog',但获得访问被拒绝错误可能是由于iframe的DOM访问限制。是否有任何方法可以从应用程序部分打开sharepoint页面。
function Dialog() {
hostweburl =
decodeURIComponent(
getQueryStringParameter('SPHostUrl')
);
appweburl =
decodeURIComponent(
getQueryStringParameter('SPAppWebUrl')
);
//alert(hostweburl);
//alert(appweburl);
var scriptbase = hostweburl + '/_layouts/15/';
$.getScript(scriptbase + 'SP.Runtime.js',
function () {
$.getScript(scriptbase + 'SP.js',
function () { $.getScript(scriptbase + 'SP.RequestExecutor.js', ShowServerInformation); }
);
}
);
}
function ShowServerInformation() {
var options = {
url: "/_layouts/Viewlsts.aspx&IsDlg=1",
tite: 'Server Information',
allowMaximize: false,
showClose: true,
width: 430,
height: 230
};
parent.SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
return false;
hostweburl =
decodeURIComponent(
getQueryStringParameter('SPHostUrl')
);
appweburl =
decodeURIComponent(
getQueryStringParameter('SPAppWebUrl')
);
//alert(hostweburl);
//alert(appweburl);
var scriptbase = hostweburl + '/_layouts/15/';
$.getScript(scriptbase + 'SP.Runtime.js',
function () {
$.getScript(scriptbase + 'SP.js',
function () { $.getScript(scriptbase + 'SP.RequestExecutor.js', ShowServerInformation); }
);
}
);
答案 0 :(得分:0)
尝试为应用提供相应的应用权限。
<AppPermissionRequests>
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
</AppPermissionRequests>
此处有更多信息:http://msdn.microsoft.com/en-us/library/office/fp142383.aspx