Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to overwrite a file in SharePoint 2013

$
0
0

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"
			    });


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>