如何在模式对话框中打开SharePoint托管应用程序? [英] How to open SharePoint hosted app in modal dialog?
问题描述
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/
最好的问候,
利跨度>
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/
Best Regards,
Lee
这篇关于如何在模式对话框中打开SharePoint托管应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!