0

i would like to add a "new folder" button to a document library page, so that, users won't have to go to the ribbon for the option. i used the following code.

<a href="javascript:OpenPopUpPageWithTitle('
    https://teams.connect.te.com/sites/PCINDIRECT/testing add folder/Forms/Upload.aspx?RootFolder=&Type=1&IsDlg=1′,RefreshOnDialogClose,null,null,'testing add folder');">New Folder</a>

the following is the original code

<a href=”javascript:OpenPopUpPageWithTitle(‘</site/library>/Forms/Upload.aspx?RootFolder=&Type=1&IsDlg=1′,RefreshOnDialogClose,null,null,'<Title>’);” >New Folder</a>

but it is not working for me. can you please advise how to fix this?

1

This approach is not recommended. Use REST,JSOM to achieve it

REST : https://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx#bk_FolderCollectionAdd

var folderPath = "Library/CustomFolder"; //TODO: get library and folder name as arguments

var folderCreate = jQuery.ajax({
"url"        : _spPageContextInfo.siteAbsoluteUrl + "/_api/Web/Folders/add("+folderPath+")",
"type"       : "POST",
"headers"    : { 
                "accept"          : "application/json; odata=verbose", 
                "content-type"    : "application/json; odata=verbose",
                "X-RequestDigest" : $("#__REQUESTDIGEST").val()
               }
}); 

jQuery.when(folderCreate).always(function (data){
   console.log(data);
});
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.