I'm using SP2010 Server with C# for development.
I'm currently writing a method that will read a couple of values from each version in a document's history. Ideally I'd like to use the same method but I ran into two issues:
1) I haven't found a way to have the flexibility to pass in either a SPListItem or SPListItemVersion.
This works: getFieldValue(My_SPListItemVersion)
This does not work: getFieldValue(My_SPListItem)
public static void getFieldValue(SPListItemVersion liVersion)
{
Console.WriteLine(field.GetFieldValueAsText(liVersion["field1"]));
Console.WriteLine(field.GetFieldValueAsText(liVersion["field2"]));
Console.WriteLine(field.GetFieldValueAsText(liVersion["field3"]));
}
2) When I iterate through the version history I can't retrieve the most recent version.
Question
Is there anyway around either one of these or should I stick to writing two methods. One for SPListItem and another for SPListItemVersion.