In Sharepoint you can use <WebPartPages:AllowFraming runat="server" /> 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 parameters into the URL.

You need to replace action=default with action=embedview, AND you need to call WopiFrame2.aspx instead of WopiFrame.aspx (which will lead to a Something Went Wrong - Sorry, you don't have access to this page).

So the URL to use for your iframe will be:https://my.company.com/sharepoint/_layouts/15/WopiFrame2.aspx?sourcedoc=/files/Demo.docx&action=embedview

Sometimes you want to modify the options for a dropdown box by removing some existing options, however you want to be able to keep these old values for reporting or whatever reasons.

Below is a way to do it by using jQuery and SharepointPlus. It will hide the “Specify your own value” stuff, and add the old value (if any) into the dropdown selection.

For example if you have a Choice field with options “A”, “B”, “C”. Your item ID #1 has value “B”.
After a while you decide to delete “B” and add “D”, but you want to be able to find items with the “B” value.
So you choose “Choice with Fill-In” and apply the below code:

// For flexibility reasons we create them as a Choice with Fill-In option,
// however we hide the free text field and we show only the dropdown
// in case of the fill-in has a value, then we add it into the list of options
$SP().formfields(["My Fist Dropdown", "Another One"]).each(function() {
var $e = this.elem();
// hide all except the dropdown
//$e.not('select').hide().filter(':radio:last').closest('tr').hide(); // SP2010
$e.eq(0).closest('table').find('tr:gt(0)').hide(); // SP2013
// if we have a value into the fill-in box, then:
// - add it into the options
// - when another value is selected we check the first checkbox
var fillValue = $e.last().val();
if (fillValue) {
$e.filter('select').append('<option data-fillin="true">'+fillValue+'</option>').each(function() {
var $this=$(this);
$this.find('option:last').prop("selected", true);
$this.removeAttr("onclick").on('change', function(event) {
var $opt = $(this).find(':selected');
if ($opt.data("fillin")) {
$e.filter(':radio:last').prop("checked", true);
} else {
$e.filter(':radio:first').prop("checked", true);
}
});
});
}
})

So now, if you create a new item you’ll see a dropdown with “A”, “C”, and “D” only.
But if you edit your item #1, you’ll have a dropdown with “A”, “C”, “D” and “B”.

With Sharepoint 2013 I wanted an easy way to list of the pages in my masterpage galery that haven’t been published yet.

You first need to Create a new view named Unpublished Content. You can sort by Name, and scroll down to the Folders settings and choose Show all items without folders.

We now have all our files in the view.

Next, switch to the Library ribbon and choose Modify in SharePoint Designer (Advanced) from the Modify View dropdown.

Sharepoint Designer will open your page.

In Sharepoint Designer, switch to the Home tab and choose Advanced Mode. The file is reloaded.

Search into your code the tag ListViewXml. On this line you should have &lt;Query;&&gt;. Just after it, we need to add:&lt;Where&gt;&lt;Or&gt;&lt;Eq&gt;&lt;FieldRef Name="_ModerationStatus" /&gt;&lt;Value Type="ModStat"&gt;Draft&lt;/Value&gt;&lt;/Eq&gt;&lt;IsNotNull&gt;&lt;FieldRef Name="CheckoutUser" /&gt;&lt;/IsNotNull&gt;&lt;/Or&gt;&lt;/Where&gt;

I needed to communicate with an iframe on Sharepoint, however Sharepoint returned Load denied by X-Frame-Options … To override this limitation you have to create a Webpart page where you’ll add the code <WebPartPages:AllowFraming runat="server" /> into the <asp:Content> section (that might work somewhere else, but I did this way).

You can also add it into your masterpage to allow it everywhere on your website. Add it into your <head> block: