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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to download notes in Online CRM 2015 using asp.net

(0) ShareShare
ReportReport
Posted on by

I am developing a web form in asp.net to provide links to every note in my CRM online account, so that by clicking those links I can see/download those files(notes) on my computer system.

one option that I was considering is to create the copy of the files on my local server and then giving that link to the users, but that will create duplicacy. ( more time complex when no. of files are large and their size too)

Can you help me to get direct links to those files?

*This post is locked for comments

I have the same question (0)
  • Mahendar Pal Profile Picture
    45,095 on at

    Have you checked this KB in CRM SDK , it should help you : msdn.microsoft.com/.../gg328429.aspx

  • Verified answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi Arun,

    This is really easy to do.

    Notes are stored in the annotation entity, and the content of the file attached is in the documentbody field, which is a string. To get the file as a byte[] for your users to consume it, convert it using:

    byte[] fileContent = Convert.FromBase64String(this.documentbody);

    If you want to let the user download the note from a .Net web application, let them click on the note they want, get the file contents, then write it to the response like this:

    byte[] fileContent = Convert.FromBase64String( {the notes document body attribute });
    
    this.Page.Response.Clear();
    this.Page.Response.AddHeader("Content-Disposition", "attachment; filename=" + "TheFileName.ext");
    this.Page.Response.AddHeader("Content-Length", fileContent.Length.ToString());
    this.Page.Response.ContentType = "application/octet-stream";
    this.Page.Response.BinaryWrite(fileContent);
    this.Page.Response.Flush();
    this.Page.Response.End();


    If this helps I'd appreciate if you would mark this as a Verified answer.

    Thanks,

      Aiden

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans