I'm trying to implement a method that retrieve a "file version" that will must be the same of the parameter number I'm going o pass.
SPListItem item = attachments.First();
var ultimaVersione = (from SPListItemVersion ver in item.Versions where ver.IsCurrentVersion select ver).First();
var tutteLeVersioni = item.File.Versions;
var versioni = new int[tutteLeVersioni.Count];
for (int i = 0; i <= versioni.Length; i++ )
{
if(tutteLeVersioni[i].ID== getFileObj.versionNumber)
{
tutteLeVersioni.RestoreByID(tutteLeVersioni[i].ID);
files.Add(new fileList() { file = tutteLeVersioni[i].File.OpenBinary() });
tutteLeVersioni.RestoreByID(ultimaVersione.VersionId);
found = true;
}
}
I've been trying restoring the file with the chosen version, and then retrieve it. But I noticed that with the method "RestoreByID()", it it puts one more version Item inside the Item. Some idea???
