I am using following code to attach the image file to the list item using C# CSOM.
using (ClientContext clientContext = new ClientContext(siteUrl)) { List list = clientContext.Web.Lists.GetByTitle(ListName); ListItem item = list.GetItemById(1); var attachment = new AttachmentCreationInformation(); attachment.FileName = "fileName.jpg"; attachment.ContentStream = fs; // My file stream Attachment att = item.AttachmentFiles.Add(attachment); clientContext.Load(att); clientContext.ExecuteQuery(); } It work fine, but when I try to attach the file with the same name then it throw an error:
The specified name is already in use.The document or folder name was not changed. To change the name to a different value, close this dialog and edit the properties of the document or folder
I want that previous file should be overwrite with new file. I am unable to find any properties.
Any suggestions?
