Forum Discussion
Padmanaban_Jayaraman
Sep 23, 2021Copper Contributor
SharePoint on-premises: Get/Download the historical file version content using CSOM
Using CSOM, we are trying to get/download the file version but we are getting error (File not found error). How to get the content of the file version using CSOM and also how to get the metadata (Changed metadata information) in SharePoint on-premises using CSOM.
We have verified in SP2013 and SP2016 environment.
Here is our Code:
Guid LibraryGuid = Guid.Parse(libraryID);
ListItem oItem = clientContext.Web.Lists.GetById(LibraryGuid).GetItemById(Convert.ToString(id)); clientContext.Load(oItem.File, file => file.Versions);
clientContext.ExecuteQuery();
FileVersion oFileVersion = oItem.File.Versions.GetById((int)fileVersionID);
ClientResult VersionStream = oFileVersion.OpenBinaryStream();
No RepliesBe the first to reply