Wednesday, September 23, 2015

Fix: Drag and Drop File Upload on Published SharePoint 2013 Pages

Ran into a long existing bug in SharePoint 2013 where you have a couple of conditions prevent uploading a file to a document library by drag & drop.

The conditions are these:

The document library is exposed as a webpart view on the page.
The page is a published page (as opposed to draft or checked-out) in a site where publishing is enabled at the site collection level.   (note that drag and drop uploads work if the page is not published.)

A number of posts describe the problem out on the interwebs, but I couldn't find a single one with a working solution... 

They talked about dragdrop.js and the SP.Utilities.CommandBlock undefined error, and setting x-ua-compatible to IE9, and a few other pieces to the puzzle... 

After a consult with the gang around the BlueMetal office, we collectively arrived at the following solution, using Script On Demand functionality...

The fix is to add the following to a script block at the bottom of the master page associated with the published page:

<script type="text/javascript">

     //Drag & Drop fix for publishing pages      

That forces those libraries to load for your masterpage even if nothing else on the page requires them.

Post a Comment