Below is the error code as well as my code. How can I fix this error please?
Request failed: ServerRelativeUrl Parameter name: Specified value is not supported for the serverRelativeUrl
function deleteFile(fileName)
{
alert('delete file is reached.');
alert(fileName);
var clientContext;
var oWebsite;
var fileUrl2 = "mySharePointsiteurl/Shared Documents/";
fileUrl2 += fileName;
alert(fileUrl2);
clientContext = new SP.ClientContext.get_current();
oWebsite = clientContext.get_web();
clientContext.load(oWebsite);
this.fileToDelete = oWebsite.getFileByServerRelativeUrl(fileUrl2);
this.fileToDelete.deleteObject();
clientContext.executeQueryAsync(
Function.createDelegate(this, this.successfileDeletionHandler),Function.createDelegate(this, this.errorfileDeletionHandler)
);
}
function successfileDeletionHandler()
{
alert('the file has been deleted. You can verify the deletion by checking the document library.');
}
function errorfileDeletionHandler() {
alert('Request failed: ' + arguments[1].get_message());
}
faye fouladi