C# upload of multiple files to notes and attachments in Dynamics 365

452 Views Asked by At

The following code allows you to upload a single file with notes.

string entitytype_attachment = "incident";
Entity Note_attachment = new Entity("annotation");
Note_attachment["objectid"] = new Microsoft.Xrm.Sdk.EntityReference(entitytype_attachment, IncidentGuid);
Note_attachment["filename"] = "testFileName.txt"
Note_attachment["isdocument"] = true;
Note_attachment["documentbody"] = "TU0gVGV4dCBGaWxl";
svc.Create(Note_attachment);

Could you please tell me how to attach multiple files with a note using the existing code.?

1

There are 1 best solutions below

0
jasonscript On BEST ANSWER

Annotation only supports a single Attachment. If you want to have multiple attachments, you need to create a new Annotation record for each attachment.