3

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["[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);
2

1 Answer 1

3

You have couple of issues in code.
1. Typo in mimetype
2. Incorrect Single valued navigation property - [email protected] 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["[email protected]"] = "/accounts(C5DDA727-B375-E611-80C8-00155D00083F)";
note["documentbody"] = [base64String]; 

Reference & similar thread

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.