Below code goes to success for creating folder in sharepoint list, but when I see it in list, its not created.
var url_web = _spPageContextInfo.webAbsoluteUrl;
var docLibrary = "Location_Ref";
var folderUrl = docLibrary + "/" + "Doc-Location3";
var folderPayload = { '__metadata': { 'type': 'SP.Folder' }, 'ServerRelativeUrl': "folderPayload "};
$.ajax({
url: url_web + "/_api/web/folders",
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(folderPayload),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function(){
alert("success");
},
error: function(){
alert("error");
}
});
what to do now?
var folderPayload = { '__metadata': { 'type': 'SP.Folder' }, 'ServerRelativeUrl': "folderPayload "};
folderPayload isn't a server relative url no matter how you slice it, also needs a beginning slash/