We help IT Professionals succeed at work.
Get Started

how to download annotation attachments from Microsoft dynamics 4.0 Cases

2,035 Views
Last Modified: 2013-12-17
HI All,

I am working on a self service portal as part of extension of the Microsoft Dynamics.

I have a web scenario where I am logging Cases directly in MSD from Web using the Web portal.

I am able to log new case and insert/retreive Notes/Artilces from the Case as part of discussions.

I also have one option to upload the attachements with the Note which is working fine for me.


The Issue comes when i try to download the attachments.

I am able to download only txt files correctly all other formats are always corrupted when i download the file.

Below is the code which i m using to download file


   private void DownloadFile(string FileData, String FileName, int FileSize, String MimeType)
    {
        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.ContentType = "application/x-unknown";
        Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + FileName + "\"");
        Response.BinaryWrite(Convert.FromBase64String(FileData));
        Response.End();
    }

For uploading the file i m using

annotation.documentbody=Convert.ToBase64String(fuAttachment.FileBytes)


Can please anyone help me on the issue that why is the file not downloaded correctly.

One thing more The attachments which are uploaded from web can be downloaded from the MSD Case correctly so there is no issue with uploaded format.

Thanks in Advance..!

Comment
Watch Question
Chief Technology Ninja
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 26 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE