I'm trying to get file versions from an an SPListItem...
I tried in many way, looping on SPListItem.Versions or SPListItem.File.Versions, tring to return my byte stream..
I can retrieve file info's, like version, size etc, but whenever I try to get the "real" file of that version, i retrieve alway the last published...
This is a code draft:
List<byte[]> Files = new List<byte[]>();
var versions = item.File.Versions;
foreach (SPListItemVersion version in item.Versions)
{
string author = version.CreatedBy.User.LoginName;
DateTime lastMod= version.Created;
long version = version.VersionId;
foreach (SPFileVersion fileVersion in versions)
{
Files.Add(fileVersion.OpenBinary());
}
}
I tryed also accessing the SPListItem.Versions (not File.Versions) and accessing the file in many other ways... How could I access the file without "restore it"?
Thank you very much!