web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to upload file using mscrm 2016

(0) ShareShare
ReportReport
Posted on by 242

Dear All,

I want to add two attachment in  notes  using html and upload it using plugin but the attachment should have two separate upload buttons like this 

1321.Capture.PNG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Emre GULCAN Profile Picture
    2,379 on at

    Hi,

    You should use "annotation (note)" entity in Dynamics CRM and attach (upload) file to this. Of course you need read your files with your code and get Base64 or ByteArray data to create annotation attachment. You can see details about annotation entity on https://msdn.microsoft.com/en-us/library/gg334398(v=crm.8).aspx  and also find sample code to upload https://msdn.microsoft.com/en-us/library/gg328429.aspx 

    Other way, you can use my library called XrmLibrary that includes some helper methods to do SDK operations by easyway, sample codes below;

    EntityReference entityReference = new EntityReference("your primary entity logical name", Guid.Parse("your record ID"));
    
    AttachmentData attachmentData = AttachmentHelper.CreateFromPath(@"your file path", "your file name"); //you can also use "CreateFromBase64", "CreateFromByte", "CreateFromStream"
    
    AnnotationHelper annotationHelper = new AnnotationHelper(organizationService);
    annotationHelper.Create(entityReference, "Your note subject", "your note text", attachmentData);


    1586.attachment.PNG

  • ashlega Profile Picture
    34,477 on at

    I'd add a couple of things:

    - You can have only 1 attachment per note (because attachments is stored in the note.. it's just a field there)

    - There is an awesome drag-drop example here:

    https://community.dynamics.com/crm/b/microsoftdynamicscrmandstuff/archive/2016/10/27/drag-amp-drop-file-upload-part-1

    You may not have to implement drag-drop, but that code may give you some ideas (most likely, if you want two buttons, you'll have to go for a web resource.. and, then, programmatically create two notes behind the scene)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans