Last active
June 30, 2023 14:43
-
-
Save vaderj/f82bca9212f7418def49e56f396a1d72 to your computer and use it in GitHub Desktop.
SP REST: Create new folder in SP Library #Javascript #REST #SharePoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createFolder(libraryName,newFolderName) | |
{ | |
var folder = jQuery.ajax({ | |
url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Folders/add('" + libraryName + "/" + newFolderName + "')", | |
type: 'POST', | |
contentType: 'application/json;odata=verbose', | |
headers: { | |
'Accept': 'application/json;odata=verbose', | |
'content-type':'application/json;odata=verbose', | |
'X-RequestDigest': $("#__REQUESTDIGEST").val() | |
} | |
}); | |
folder.done(function(listData, textStatus, jqXHR) | |
{ | |
console.dir(listData) ; | |
console.dir(textStatus) ; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment