Anyone knows how to create an "annotation" using CRM Web API. I can create other objects such as account and contacts but annotation attachment is a no go. Seems like my object is missing something.
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);
You have couple of issues in code.
1. Typo in mimetype
2. Incorrect Single valued navigation property - objectid@odata.bind and it should be objectid_[entity]@odata.bind
Necessary properties should look like below:
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];