locked
How to show DocumentBody of CRM Annotation in aspx page RRS feed

  • Question

  • Hello!

    In my asp.net Portal project I need to show the content of a CRM Annotation in an aspx page.

    I can get the content of it and download as word document, i.e, but I would like to show the content when its a word document in a new aspx page.

    Which workaround can I follow?


    Wednesday, March 12, 2014 4:14 PM

All replies

  • Hi,

    I got a doubt here... what if the Annotation has Image, PDF or some other file attached to it? I guess, its better to give download option to the user.

    --

    Regards,

    Gopinath

    http://mscrmtechie.blogspot.in/

    Wednesday, March 12, 2014 4:21 PM
  • I can check it with annotation.MimeType, and yes with other types of files I'll allow download.
    Wednesday, March 12, 2014 4:24 PM
  • Then, you should know about reading a word document in C#... If yes, check the below the link.

    http://www.mindstick.com/Articles/5cd1b721-9b94-4ea0-bd6e-2bb157401069/?Read%20Microsoft%20Word%20Document%20File%20by%20using%20C

    --

    Gopinath

    http://mscrmtechie.blogspot.in/

    Wednesday, March 12, 2014 4:41 PM
  • Yes, I checked that also, the problem that I found is that I don't have a direct link to the word document in the Annotation,

    With https://server.domain.com/XRMServices/2011/OrganizationData.svc/AnnotationSet(guid'b085c5fe-eda9-e311-b5a7-00155d524881')?$select=DocumentBody

    I still get the XML page format and not the document itself.

    Wednesday, March 12, 2014 5:03 PM
  • After retreving record from CRM, we should convert it from Base 64 to string... After getting the byte array, we should have C# code to read that document(word) and display that to user. For reading the document the link given in the previous post helps you..

    Check the following link..

    http://msdn.microsoft.com/en-us/library/gg328429.aspx

    --

    Regards,

    Gopinath.

    Wednesday, March 12, 2014 5:26 PM
  • I worked with Microsoft.Office.Interop.Word.Document and seemed to me that you need the word document itself and nothing could be done having the DocumentBody. 

    Will I be able to write this content with fileStream.Write to a new page? I'm gonna try now.


    Wednesday, March 12, 2014 5:45 PM
  • Is the only method available create the word document locally and after convert to HTML?

    Is not any other way to accomplish what I want?

    Tuesday, March 18, 2014 9:40 AM