SharePoint add “Add New Document” to Document Set home page

Add the below code to the document set home page using a content editor webpart.


<TD class=ms-addnew style=”PADDING-BOTTOM: 3px”>
<SPAN class=s4-clust style=”OVERFLOW: hidden; HEIGHT: 10px; WIDTH: 10px; POSITION: relative; DISPLAY: inline-block”><IMG style=”POSITION: absolute; LEFT: 0px !important; TOP: -128px !important” alt=”” src=”/_layouts/images/fgimg.png”></SPAN>&nbsp;<A class=ms-addnew id=idHomePageNewDocument onclick=’javascript:addDocs();’>Add document</A></TD>

<script type=”text/javascript” src=”/Scripts/SPServices/jquery.SPServices-0.7.2.min.js”></script>

<script type=”text/javascript”>
// Close Callback for modal
function CloseCallback(result, target) {
if (result === SP.UI.DialogResult.OK) {

// Add documents to document set

function addDocs() {
var queryStringVals = $().SPServices.SPGetQueryString();
var id = queryStringVals[“ID”];
var ListID=queryStringVals[“List”];
var rootFolder = queryStringVals[“RootFolder”];
var options = SP.UI.$create_DialogOptions();
var itemURL = “http://siteurl/” + rootFolder;
options.url = “http://siteurl/_layouts/Upload.aspx?List=”+ListID;
options.url += “&RootFolder=” + rootFolder;
//options.url += “&MultipleUpload=1&IsDlg=1”;
options.url += “&IsDlg=1”;
options.url += “&Source=” + STSHtmlEncode(itemURL);
options.AllowMaximize = true;
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);


Leave a Reply

Your email address will not be published. Required fields are marked *