
QueryExpression noteQuery = new QueryExpression
{
EntityName = "annotation",
ColumnSet = new ColumnSet(true),
Criteria = new FilterExpression
{
Conditions =
{
new ConditionExpression
{
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.
*This post is locked for comments
I have the same question (0)Hi,
You're not going to be able to do it easily. You'll need to get one of the open source Office readers and access the document that way, hoping to be able to pull the content out of the doc. It may not be perfect because the doc may have tables and other formatting that won't translate easily to plain text.
Hope this helps! I'd appreciate if you'd mark this as Answering your question.
Thanks,
Aiden