pnpjs
pnpjs copied to clipboard
How to download older version files?
Category
- [ ] Enhancement
- [ ] Bug
- [x] Question
- [ ] Documentation gap/issue
Version
Please specify what version of the library you are using: [3.7.0]
Please specify what version(s) of SharePoint you are targeting: [web]
Question
As the title, how do I download the file of older versions.
const firstVersion: IVersion = sp.web.getFileByUrl("path/to/file").versions.getById(512); // first version
# then what?
This hack works
const stream = await (<IFile>firstVersion).getStream().then(res => res.body);
Is this reliable?
Yes, that should be reliable. Each version points to a "file" so we could expose all the file methods on versions. Will need to do some validation to see if that is 100% true, but I think there is room to improve what we are doing for versions.
Hi +1 for adding the ability to get contents of older versions of files. I have a need to do that in a current project. (And I couldnt get gomains hack to work :-() Russell
Added methods for getting content of versions to IVersion as well improved the typing of IVersionInfo to include returned fields.
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.