Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

How to convert MsWord Doc attachement of note to Plain text

$
0
0

QueryExpression noteQuery = newQueryExpression

{

EntityName = "annotation",

ColumnSet = newColumnSet(true),

Criteria = newFilterExpression

{

Conditions =

{

newConditionExpression

{

AttributeName = "objectid",

Operator = ConditionOperator.Equal,

Values = { "92F7CEA6-7D7A-E611-81AC-001DD8B84ED2" }

},

}

}

};

EntityCollection notesCollection = service.RetrieveMultiple(noteQuery);

if (notesCollection.Entities.Count > 0)

{

foreach (Entity note in notesCollection.Entities)

{

if (note.Attributes.Contains("annotationid"))

{

Guid noteId = (Guid)note["annotationid"];

 }

if (note.Attributes.Contains("filename"))

{

String fileName = note["filename"].ToString();

 }

if (note.Attributes.Contains("documentbody"))

{

String file = note["documentbody"].ToString();

Console.WriteLine(file);

 }

}

}

I am getting documentbody as a base64 string how do I convert that to Plain text

byte[] theData = Convert.FromBase64String(file);

string content = System.Text.Encoding.UTF8.GetString(file);

this will not work as Attachement is wordDoc.


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>