SharePoint / PnP-JS-Core

Code moved to https://github.com/pnp/pnpjs. This repository is archived.
Other
379 stars 231 forks source link

How to get specific version of item? #827

Closed vincent-chan-hk closed 6 years ago

vincent-chan-hk commented 6 years ago

Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your needs please complete the below template to ensure we have the details to help. Thanks!

Please check out the Developer Guide to see if your question is already addressed there. This will help us ensure our documentation covers the most frequent questions.

Category

[ ] Enhancement

[X ] Bug

[X ] Question

Version

Please specify what version of the library you are using: [ 3.0.7 ]

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

I found that it should have method of getting specific version of item (added support for additional file version methods and added support f… #651). But I cannot find out how to use this method in existing documentation. Please teach me! Thanks!

If you are reporting an issue please describe the expected behavior. If you are suggesting an enhancement please describe thoroughly the enhancement, how it can be achieved, and expected benefit. If you are asking a question, ask away!

Observed Behavior

If you are reporting an issue please describe the behavior you expected to occur when performing the action. If you are making a suggestion or asking a question delete this section.

Steps to Reproduce

If you are reporting an issue please describe the steps to reproduce the bug in sufficient detail to allow testing. If you are making a suggestion or asking a question delete this section.

Submission Guidelines

Delete this section after reading

Thanks!

koltyakov commented 6 years ago

Hi @vincent-chan-hk,

You can get item's version using item.version method, or item.versions.getById for a specific version. Though, it'll work in SPO as versions API landed to REST not far ago.

item.versions.get().then(console.log); // all versions info
item.versions.getById(512).get().then(console.log); // a specific version

image


Thank you for your interest in the sp-pnp-js library. We wanted to mention that this library is being deprecated in July 2018 in favor of the new scoped pnpjs libraries. You should begin transitioning your existing projects when possible or start new projects with the new libraries. Please see the transition guide for more details on migrating and be sure to let us know if you have any questions. Thanks!

vincent-chan-hk commented 6 years ago

Thank you for your quick response! You save my Happy Friday! I completed my coding and I can have a drink in Lan Kwai Fong. :) Happy Friday!

koltyakov commented 6 years ago

Cheers, buddy!