通过CRM Web API创建注释
问题描述:
任何人都知道如何使用CRM Web API创建“注释”。我可以创建其他对象,如帐户和联系人,但注释附件是不可行的。似乎我的对象缺少一些东西。通过CRM Web API创建注释
JObject notes = null;
notes = new JObject();
notes["isdocument"] = true;
notes["objecttypecode"] = "mfr_ownermlslistingwaiver";
notes["[email protected]"] = "/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["[email protected]"] = "/mfr_ownermlslistingwaivers(137C660B-ADAA-E711-80CD-005056927DF7)";
HttpResponseMessage createResponse =
await httpClient.SendAsJsonAsync(HttpMethod.Post, "annotations", notes);
答
你有几个代码问题。
1.错字在MIME类型
2.不正确的单值导航属性 - [email protected]并且它应该是objectid_ [实体] @ odata.bind
必要的属性应该如下:
note["notetext"] = "Invoice Report Attached"
note["subject"] = "Invoice";
note["filename"] = "Invoice.pdf";
note["mimetype"] = "application/pdf";
note["[email protected]"] = "/accounts(C5DDA727-B375-E611-80C8-00155D00083F)";
note["documentbody"] = [base64String];
您是否收到任何类型的错误信息?也许尝试同步发送它看看会发生什么。另外,你有没有咨询这个例子? https://msdn.microsoft.com/en-us/library/gg328429.aspx –
[通过API在Microsoft Dynamics CRM中为联系人实体创建注释]的可能重复(https://*.com/questions/32761311/创建的注释到一个接触 - 实体 - 在微软动力学-CRM逐API) –