通过 CRM Web 创建注释 API

Create annotation via CRM Web API

任何人都知道如何使用 CRM Web API 创建 "annotation"。我可以创建其他对象,如帐户和联系人,但注释附件是不行的。好像我的对象少了什么。

    JObject notes = null;
            notes = new JObject();

            notes["isdocument"] = true;
            notes["objecttypecode"] = "mfr_ownermlslistingwaiver";
            notes["ownerid@odata.bind"] = "/systemusers(E94126AC-64FB-E211-9BED-005056920E6D)";
            notes["owneridtype"] = 8;
            notes["documentbody"] = "/9j/4VmjRXhpZgAASUkqAAgAAAANAAABBAABAAAAIBAAAAEBB...";
            notes["minetype"] = "image/jpeg";
            notes["filename"] ="2213 Scrub Jay Rd.jpg";
            notes["objectid@odata.bind"] = "/mfr_ownermlslistingwaivers(137C660B-ADAA-E711-80CD-005056927DF7)"; 
HttpResponseMessage createResponse =
              await httpClient.SendAsJsonAsync(HttpMethod.Post, "annotations", notes);

您的代码有几个问题。
1. mimetype 错别字
2. 不正确的单值导航 属性 - objectid@odata.bind 应该是 objectid_[entity]@odata.bind

必要的属性应如下所示:

note["notetext"] = "Invoice Report Attached"
note["subject"] = "Invoice";
note["filename"] = "Invoice.pdf";
note["mimetype"] = "application/pdf";
note["objectid_account@odata.bind"] = "/accounts(C5DDA727-B375-E611-80C8-00155D00083F)";
note["documentbody"] = [base64String]; 

Reference &