1

任何人都知道如何使用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); 
+0

您是否收到任何類型的錯誤信息?也許嘗試同步發送它看看會發生什麼。另外,你有沒有諮詢這個例子? https://msdn.microsoft.com/en-us/library/gg328429.aspx –

+0

[通過API在Microsoft Dynamics CRM中爲聯繫人實體創建註釋]的可能重複(https://stackoverflow.com/questions/32761311/創建的註釋到一個接觸 - 實體 - 在微軟動力學-CRM逐API) –

回答

0

你有幾個代碼問題。
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]; 

Reference & similar thread