Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to upload file using mscrm 2016

(0) ShareShare
ReportReport
Posted on by 240

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

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: How to upload file using mscrm 2016

    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)

  • Suggested answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: How to upload file using mscrm 2016

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans