1

I am trying to retrieve ListItemAllFields for a previous version of a file in a Document Library

foreach (FileVersion version in listItem.File.Versions)
        {
string versionItemUrl = listItem.File.ServerRelativeUrl.Replace(Path.GetFileName(listItem.File.ServerRelativeUrl), "") + version.Url;
            Microsoft.SharePoint.Client.File oldFile = 
web.GetFileByServerRelativeUrl(versionItemUrl);
var allFields = oldFile.ListItemAllFields;
clientContext.Load(oldFile, f => f.ListItemAllFields);
clientContext.ExecuteQuery();}

Everything works fine up to this point, but all properties in ListItemAllFields come up as not initialized. Basically the listItem returns empty

Browse other questions tagged or ask your own question.