Hi,
Following is the code snippet i am using to add attachment. But getting an error if i try to add the same attachment again.
I want to overwrite a file if it exists.
$.getScript(scriptbase + "SP.RequestExecutor.js", function(){
var createitem = new SP.RequestExecutor("https://development.ok.com/sites/test/uk/");
createitem.executeAsync({
url: "https://development.ok.com/sites/test/uk/_api/web/lists/GetByTitle('"+listName+"')/items("+id+")/AttachmentFiles/add(FileName='" + file.name + "')",
method: "POST",
binaryStringRequestBody: true,
body: binary,
success: fsucc,
error: ferr,
state: "Update"
});