3

任何人都知道如何使用 CRM Web API 创建“注释”。我可以创建其他对象,例如帐户和联系人,但注释附件是不行的。好像我的对象丢失了一些东西。

    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);
4

1 回答 1

3

您在代码中有几个问题。
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]; 

参考类似线程

于 2017-10-10T22:50:51.257 回答