我在发送附件时遇到一些问题。它看起来是这样的:
{
"filename": "Test.txt",
"subject": "Test",
"mimetype": "text/plain",
"documentbody": "SABlAGwAbABvACAAVwBvAHIAbABkAA==",
"objectid@odata.bind": "/accounts(3ba2f6ab-3849-e811-a83b-000d3a2b2acb)",
"isdocument": true
}我得到的错误是:
"error": {
"code": "0x0",
"message": "An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'objectid' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values."有什么问题的线索吗?我是否错误地定义了注释和帐户之间的关系?
发布于 2020-03-19 22:26:14
这项工作没有任何问题。objectid_account@odata.bind是绝对必要的,因为objectid可以存储任何实体。Read more
var entity = {};
entity.subject = "arun test";
entity["objectid_account@odata.bind"] = "/accounts(4B91608D-3C5A-EA11-A811-000D3A5A1CAC)";
entity.notetext = "blah blah";
entity.filename = "arun.txt";
entity.documentbody = "SABlAGwAbABvACAAVwBvAHIAbABkAA==";
entity.isdocument = true;
Xrm.WebApi.online.createRecord("annotation", entity).then(
function success(result) {
var newEntityId = result.id;
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);发布于 2020-03-19 16:47:01
请在下面尝试,您缺少MimeType,这对于了解附件的类型很重要。我刚在我的一个系统上试了试,它工作正常。
{
"filename": "Test.txt",
"documentbody": "SABlAGwAbABvACAAVwBvAHIAbABkAA==",
"objectid@odata.bind": "/accounts(3ba2f6ab-3849-e811-a83b-000d3a2b2acb)",
"isdocument": true
"mimetype": "text/plain";
"subject": "testing from CRM Webapi 33";
}https://stackoverflow.com/questions/60752885
复制相似问题