目前我们使用 SAP REST API 来上传和管理附件。
我们想用 SDK 替换标准请求,因为我们在通过CloudConnector
相应的代理设置获取连接时遇到问题,而且我们还使用 SDK 处理所有其他请求。
var attContentSetBuilder = AttachmentContentSet.builder();
attContentSetBuilder.documentInfoRecordDocNumber("10000000008");
attContentSetBuilder.documentInfoRecordDocPart("000");
attContentSetBuilder.documentInfoRecordDocType("YBO");
attContentSetBuilder.documentInfoRecordDocVersion("01");
attContentSetBuilder.businessObjectTypeName("DRAW");
attContentSetBuilder.fileName("TEST.pdf")
attContentSetBuilder.content(fileToBase64("C:\\TEST.pdf"));
var attContentSet = attContentSetBuilder.build();
var requestBuilder = new AttachmentContentSetRequestBuilder();
var contentSetRequester = requestBuilder.create(attContentSet);
contentSetRequester.withCustomHeaders({ key: 'slug', value: 'TEST.pdf' }).execute({XXX}).then ...
function fileToBase64(filename: string): string {
var fs = require('fs');
return fs.readFileSync(filename, 'utf8');
}
带有二进制数据的内容/正文会以这种方式设置吗?是否slug
还必须设置标头值?附件服务是否也支持GOS
?到目前为止,我们得到了错误:
“附件名称不能为空”