{"id":1832,"date":"2017-07-25T11:17:56","date_gmt":"2017-07-25T09:17:56","guid":{"rendered":"https:\/\/blog.kodono.info\/wordpress\/?p=1832"},"modified":"2017-08-02T09:56:14","modified_gmt":"2017-08-02T07:56:14","slug":"sharepoint-wopiframe-allow-framing","status":"publish","type":"post","link":"https:\/\/blog.kodono.info\/wordpress\/2017\/07\/25\/sharepoint-wopiframe-allow-framing\/","title":{"rendered":"Sharepoint WopiFrame allow framing"},"content":{"rendered":"<p>In Sharepoint you can use <code>&lt;WebPartPages:AllowFraming runat=\"server\" \/><\/code> to disable the SAMEORIGIN for X-FRAME-OPTION giving you the opportunity to call your page from an iframe (see <a href=\"https:\/\/blog.kodono.info\/wordpress\/2016\/11\/08\/disable-x-frame-options-on-sharepoint\/\">this other article<\/a>).<\/p>\n<p>However you cannot use the same trick to preview a file into the browser with <code>WopiFrame.aspx<\/code>. But there is a way to do it, using the parameters into the URL.<\/p>\n<p>Let&#8217;s say the url to preview your document is:<br \/>\n<strong>https:\/\/my.company.com\/sharepoint\/_layouts\/15\/WopiFrame.aspx?sourcedoc=\/files\/Demo.docx&#038;action=default<\/strong><\/p>\n<p>You need to replace <code>action=default<\/code> with <code>action=embedview<\/code>, AND you need to call <code>WopiFrame2.aspx<\/code> instead of <code>WopiFrame.aspx<\/code> (which will lead to a <code>Something Went Wrong - Sorry, you don't have access to this page<\/code>).<\/p>\n<p>So the URL to use for your iframe will be:<br \/>\n<strong>https:\/\/my.company.com\/sharepoint\/_layouts\/15\/WopiFrame2.aspx?sourcedoc=\/files\/Demo.docx&#038;action=embedview<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Sharepoint you can use &lt;WebPartPages:AllowFraming runat=&#8221;server&#8221; \/> to disable the SAMEORIGIN for X-FRAME-OPTION giving you the opportunity to call your page from an iframe (see this other article). However you cannot use the same trick to preview a file into the browser with WopiFrame.aspx. But there is a way to do it, using the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","hide_page_title":"","footnotes":""},"categories":[15,170,13,33],"tags":[123,152,158,117],"class_list":["post-1832","post","type-post","status-publish","format-standard","hentry","category-astuce","category-english","category-niveau-intermediaire","category-programmation","tag-english","tag-niveau-intermediaire","tag-programmation","tag-sharepoint"],"_links":{"self":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/comments?post=1832"}],"version-history":[{"count":4,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1832\/revisions"}],"predecessor-version":[{"id":1839,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1832\/revisions\/1839"}],"wp:attachment":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/media?parent=1832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/categories?post=1832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/tags?post=1832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}