Programmatically get ListItemVersion using client object model SharePoint 2010

后端 未结 1 1199
情深已故
情深已故 2021-02-15 22:11

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

相关标签:
1条回答
  • 2021-02-15 22:36

    You have to initialize web.ServerRelativeUrl like this

    oldVersions = clientContext.LoadQuery(versions.Where(v => v != null));
    clientContext.Load(web, w => w.ServerRelativeUrl);
    clientContext.ExecuteQuery();
    
    0 讨论(0)
  • 2021-02-15 22:43

    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();
    0 讨论(0)
提交回复
热议问题