SAP Knowledge Base Article - Public

2831410 - Unable to insert Attachment via ODATA API 'Attachment' Entity with file type docx or doc

Symptom

When creating an attachment via Postman, below error that attachment file is not supported is returned as a response.

Sample Request Payload

{
"__metadata": {
"uri": "Attachment"
},
"userId": "cgrant",
"fileName": "f1.docx",
"description": "des1",
"fileContent": "ZHV6aWVsZQ==",
"viewable": true,
"deletable": false,
"moduleCategory": "PERFORMANCE_ASSESSMENTS",
"module": "PERFORMANCE_MANAGER"

}

Sample Response Body

<?xml version="1.0" encoding="utf-8"?>

<error xmlns=" http://schemas.microsoft.com/ado/2007/08/dataservices/metadata "> <code>COE_GENERAL_SERVER_FAILURE</code>

<message lang="en-US">[COE0019]The file type of testJC1.docx is not supported for attachments</message></error>

Environment

SAP Successfactors HCM Suite

Reproducing the Issue

1. Perform Odata API Upsert/Insert Operation using SFOdata.Attachment entity

2. See error when upserting/insert xx.docx, xx.doc file or fileContent string.

Cause

For MS Word document type attachment converted to base64 string

If the fileName is xxx.doc or xxx.docx, but the file content not a MS Word document, for example, a string or text file was instead converted to base64. Insert/Upsert/Update operation of API will not succeed.

Before 1711 release, the attachment can be inserted.
Since 1711 release, the attachment cannot be inserted because of the type and content check.

Resolution

Ensure that the data in 'fileContent' field of the request payload is a valid base64 encoded string of a xx.doc or xx.docx file.

See Also

SAP SuccessFactors HCM Suite OData API: Reference Guide

Keywords

SFOdata.Attachment, xxx.do, xxx.docx, MS Word Odata Attachment, fileContent, base64, [COE0019]The file type of **.docx is not supported for attachments , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , Problem

Product

SAP SuccessFactors HCM Core all versions