public static string GetVersionedMultiLineTextAsPlainText(SPListItem item, string key)
{
StringBuilder sb = new StringBuilder();
foreach (SPListItemVersion version in item.Web.Lists[item.ParentList.ID].Items[item.UniqueId].Versions)
{
SPFieldMultiLineText field = version.Fields[key] as SPFieldMultiLineText;
if (field != null)
{
string comment = field.GetFieldValueAsText(version[key]);
if (comment != null && comment.Trim() != string.Empty)
{
sb.Append("");
sb.Append(version.CreatedBy.User.Name).Append(" (");
sb.Append(version.Created.ToString("MM/dd/yyyy hh:mm tt"));
sb.Append(")
");
sb.Append("-" + comment);
sb.Append("
");
}
}
}
return sb.ToString();
}