'Sending Attachment to SAP B1 remote Service Layer

In a C# application, I want to send files to "remote SAP B1 service layer". I have tried many ways to send an attachment to this remote service layer, using their b1s/v1/Attachments2 endpoint, but I continuously receive an error "A file with this name already exists. [Attachments2_Lines.FileName][line: 1], ". Even this file does not exists in the service layer shared directory. Moreover, I do have the read/write permissions in the destination path. enter image description here

Any Kind of help will be highly appreciated.



Solution 1:[1]

I had a similiar issue when adding attachments to a document. Try to send a GET and retrieve all records for /Attachments2. If the file was added before there might already exist a record having the same filename.

To add it again, you need to call a DELETE on the specific ID first, then POST it again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dev-ine