I'd like get the previous versions of files in document Library, passing as parameter the number of version.
else if(getFileObj.versionNumber!=0)
{
bool found = false;
try
{
/
foreach(SPListItem items in allegatiCollegati)
{
SPListItemVersionCollection collectionItemsVersions =items.Versions;
foreach(SPListItemVersion versions in collectionItemsVersions )
{
if(versions.VersionId == getFileObj.versionNumber)
{
SPListItem Item = items;
files.Add(new fileList() { file = Item.File.OpenBinary() });
}
}
}
found = true; if(fount== false) {throw new exception("II can't find any file with this version!");}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
I tried with this code but it returns me always the last version of the file.