How to read text/string value from docx email-activity attachment without downloading the file in dynamics crm.
*This post is locked for comments
How to read text/string value from docx email-activity attachment without downloading the file in dynamics crm.
*This post is locked for comments
Ok I realised that its a 1 year old post :) , any ways hope this will help any one who will be looking for similar solution.
Hi,
That code is actually getting word content in to byte, now you can use something like Novacode docx library to read.
using Novacode;
......
..................
...........................
var mandatoryDocument = DocX.Load(byte[]); //in place of byte[] the bytes you read from document.
Hope it will help you.
Kind Regards
Prashanth
We can tell you how to use CRM SDK to correctly extract the contents of that attachment, but not necessarily how to parse a word document in your code. This might be a question you can get answered faster at stackoverflow (or C# forums)
so my scenario is like when i get a email attachment,i need to read text values from the attachment(using docx & excel types)
thanks for the reply,
That my problem without saving or creating a word document using that value, how to get the the string values present in the encoded files?Is there any way to get the string value ?
This probably aren't 'junk values' - this is the body of the document. Word documents need to be parsed by software that understands the document format, i.e. Microsoft Word
Hello,
Check this article, it should help you to find an answer - http://lmgtfy.com/?s=b&iie=1&q=read+docx+file+in+c%23
My .doc file attachment get encode in my 'activityattachment' . so using c# i can get the 'body' value .but using that value i cant get the text/string directly.
i tired using,
var encode= ent.Attributes["body"].ToString();
byte[] byt = Convert.FromBase64String(encode);
string decodedString = Encoding.UTF8.GetString(byt);
in "decodedstring" i am getting the some junk values(pic in above post).
Hi
It looks like it is working, as you can see the content displayed.
string fileName = (string)annotationFRI.Attributes["filename"]; string noteText = (string)annotationFRI.Attributes["notetext"]; string documentBody = (string)annotationFRI.Attributes["documentbody"]; byte[] fileContent = Convert.FromBase64String(documentBody);
Thanks for sharing the reference, Mohd.
thanks for reply,
it doesnt work.
In my requirement i have to read the text/string value directly from the encoded document without downloading or saving the file.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156