我开发了一个SharePoint托管的应用程序。我有一个Web部件,我尝试显示sharepoint主机的文档库。
为此,我根据当前用户设置iframe src。但是当我设置网址时,我有错误:
拒绝在一个框架中显示“https://xxx.sharepoint.com/sites/xxx/Documentos%20compartidos/folder1/folder2”,因为它将“X-Frame-Options”设置为“sameorigin”。
我尝试设置 AppManifest.xml
<AppPrincipal>
<Internal AllowedRemoteHostUrl="https://xxx.sharepoint.com/sites/xxx"/>
</AppPrincipal>
此外,在网页部分页面的头部,我添加:
<head>
<meta http-equiv="X-Frame-Options" content="allow">
...
</head>
得到错误:
X-Frame-Options只能通过与文档一起发送的HTTP标头进行设置。它可能没有设置在里面。
如何解决错误?是否还有其他选项可以在Web部件上显示文档库?
答案 0 :(得分:0)
在搜索并阅读了一些博客之后,我发现由于安全限制,我想要它是不可能的。
我的解决方案:
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response post(@FormParam("attribute1") String attribute1, @FormParam("attribute2") String attribute2) {
return Response.ok(service.persist(MyFactory.create(attribute1, attribute2))).build();
}
从网络部件发送网址,然后使用editcontent中的jQuery更改iframe的网址