I have a scenario where I have to move all my data in a SharePoint 2010 list (name= \"VersionTestList\") to a SQL server database. Since versioning is enabled in the list, I wan
you can get older version file like this
string versionItemUrl = file.ServerRelativeUrl.Replace(Path.GetFileName(file.ServerRelativeUrl),"") + _version.Url;
File oldFile = web.GetFileByServerRelativeUrl(versionItemUrl);
clientContext.Load(oldFile, f=>f.ListItemAllFields);
clientContext.ExecuteQuery();
You have to initialize web.ServerRelativeUrl
like this
oldVersions = clientContext.LoadQuery(versions.Where(v => v != null));
clientContext.Load(web, w => w.ServerRelativeUrl);
clientContext.ExecuteQuery();