SAP Knowledge Base Article - Public

2537592 - Download Attachments Using OData Service

Symptom

You want to download the files attached to your documents (Opportunities, Service Requests, Leads, etc.) by making use of the OData Service.

Environment

SAP Cloud for Customer

Resolution

  1. Access the URL for the desired OData collection you want to use, for this test we will use the ServiceRequestCollection object.
  2. After using the URL for the object, i.e., https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection('Object ID')? . (Replace XXXXXX with your system number after "my". The Object ID here is that of a service request.)
  3. Expand the attachment folder by adding $expand=ServiceRequestAttachmentFolder at the end of the URL.
  4. Use the link provided in the property “id” that is like this: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/servicerequest/ServiceRequestAttachmentFolderCollection('Object ID'). (The Object ID here is that of an attachment. )
  5. Append the segment /Binary/$value to the end of the link above and access the link.
  6. The corresponding attachment will be downloaded.

Keywords

Download attachments, OData services, OData API , KBA , LOD-CRM-INT-API , OData API (C4C Only) , AP-RC-ODF , OData framework (C4C Only) , How To

Product

SAP Cloud for Customer add-ins all versions