1

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.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • In the c# code, I get -- error code 404 -- error message Create File Error: C:\tmp – Muhammad Sajid Feb 11 '22 at 23:44
  • Please don't use `sap` tag as per the guidelines ("DO NOT USE THIS TAG as it's ambiguous"; the reason is the same as for Microsoft and other software vendors, "microsoft" tag doesn't exist) The tag `sapb1` is sufficient. Thank you for your understanding. – Sandra Rossi Feb 12 '22 at 08:27

1 Answers1

0

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.

dev-ine
  • 26
  • 3
  • No such file with the same name exists in Attachment2 directory. Even I have tried renaming the file to some random characters. But it throws same error. – Muhammad Sajid Feb 11 '22 at 20:16
  • 1
    There might exist no file in the actual physical director, but Service Layer maybe still have a record on that file. Therefore I suggested that you try to send a GET to /Attachments2 and retrieve *all* records. In the result you can check for your file to be present. – dev-ine Mar 17 '22 at 14:20
  • Did you ever find a solution, and is there a good way to GET the newest attachments from the /Attachments2 endpoint? – Shamatix May 30 '23 at 13:51