var sb = new StringBuilder();
foreach (SPListItemVersion itemVersion in
item.Web.Lists[item.ParentList.ID]
.Items[item.UniqueId].Versions)
{
SPFieldMultiLineText field =
itemVersion .Fields[key]
as SPFieldMultiLineText;
if (field != null)
{
string comment = field.GetFieldValueAsText
(itemVersion .Fields[key]);
if (comment != null &&
comment.Trim() != string.Empty)
{
sb.Append("\n\r");
sb.Append(itemVersion .CreatedBy.User.Name)
.Append("(");
sb.Append(itemVersion .Created.ToString
("MM/dd/yyyy hh:mm tt"));
sb.Append(")");
sb.Append(comment);
row[key)] = sb.ToString();
}
}
}
|