是否可以从Sharepoint中托管的应用程序部件打开sharepoint页面作为模式对话框

时间:2013-11-11 11:09:17

标签: sharepoint-2013 showmodaldialog

我在共享点页面上的应用程序部分点击按钮时调用功能'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); } ); } );

1 个答案:

答案 0 :(得分:0)

尝试为应用提供相应的应用权限。

<AppPermissionRequests>
  <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
</AppPermissionRequests>

此处有更多信息:http://msdn.microsoft.com/en-us/library/office/fp142383.aspx