如何在模式对话框中打开SharePoint托管应用程序? [英] How to open SharePoint hosted app in modal dialog?

查看:53
本文介绍了如何在模式对话框中打开SharePoint托管应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Team,


我们要求使用自定义操作在模态对话框中打开sharepoint托管应用。


你能帮忙吗?有这个要求。


代码片段很有用。


谢谢。




VINAYAK BHANGALE

解决方案



下添加以下标签
< asp 内容
ContentPlaceHolderID =" PlaceHolderMain"
runat =" server">
在您的托管加载项.aspx页面中。


< WebPartPages AllowFraming
runat =" server"
/>


然后,你可以显示添加 - 模态对话框中的页面。

< script type =" text / javascript"> 
function openDialog(){
var options = {
//添加isdlg = 1以忽略功能区
url:" http://add-in-fd360d24349d7b.contosoaddins.com:12001 / SPHostTest / Pages / Default。 aspx",
title:" add-in",
allowMaximize:false,
showClose:true,
width:900,
height:800
};

SP.SOD.execute('sp.ui.dialog.js','SP.UI.ModalDialog.showModalDialog',options);
}
< ; / script>
< input id =" Button1" onclick =" openDialog()" type =" button" value =" button" />



虽然加载项网址会发生变化,但我建议您开发加载项部件并将加载项部件插入SharePoint页面,然后在模式对话框中显示该页面。


http://mundrisoft.com/tech-bytes/what-is-the-host-web-url-and-app-web-url-in-sharepoint-add-in/


https://docs .microsoft.com / zh-CN / sharepoint / dev / sp-add-ins / create-add-in-parts-to-your-your-sharepoint-add-in


最好的问候,



Hello Team,

We have requirement to open sharepoint hosted app in modal dialog using custom action.

Could you please help with this requirement.

Code snippets will be useful.

Thanks.


VINAYAK BHANGALE

解决方案

Hi,

Add below tag under <asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server"> in your hosted add-in .aspx page.

<WebPartPages:AllowFraming runat="server" />

Then, you can show the add-in page in modal dialog.

 <script type="text/javascript">
        function openDialog() {
            var options = {
                //add isdlg=1 to ignore ribbon
                url: "http://add-in-fd360d24349d7b.contosoaddins.com:12001/SPHostTest/Pages/Default.aspx",
                title: "add-in",
                allowMaximize: false,
                showClose: true,
                width: 900,
                height: 800
            };

            SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
        }
    </script>
    <input id="Button1" onclick="openDialog()" type="button" value="button" />

While add-in URL would change, I would suggest you develop add-in part and insert the add-in part to a SharePoint page, then display the page in modal dialog.

http://mundrisoft.com/tech-bytes/what-is-the-host-web-url-and-app-web-url-in-sharepoint-add-in/

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/create-add-in-parts-to-install-with-your-sharepoint-add-in

Best Regards,

Lee


这篇关于如何在模式对话框中打开SharePoint托管应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆