Open nozzrangar opened 4 hours ago
@nozzrangar : I can reproduce this by running our test case as "live"...so this clearly used to work but now isn't anymore. Did this work for you before and recently stopped working or are you just now trying this?
@nozzrangar : I can reproduce this by running our test case as "live"...so this clearly used to work but now isn't anymore. Did this work for you before and recently stopped working or are you just now trying this?
Yes, this used to work for me before and has recently stopped working.
Thanks @nozzrangar : when you say recently, can you be more precise?
Doing some checking on the query I notice that in case of expanding versions the $top statement is respected on the expand and therefore only the last version is returned
_api/web/lists(guid'8bcad63f-db6f-4a54-99e6-511bd1883a66')/items?$select=Id%2cVersions%2c*&$expand=Versions&$filter=Id+eq+1&$top=1
While doing a similar approach on expanding items on the list collection still works as expected and returns all items
_api/web/lists?$select=Id%2cItems%2c*&$expand=Items&$filter=Id+eq+guid'e083c5b2-9a36-48db-86ec-9a697be704ea'&$top=1
@jansenbe Looking quickly through my logs I can see it is working normally on 16/09/2024 but then I see errors coming because of this starting on 18/09/2024.
The error is coming because in my code I'm checking if the version label of the current version is greater than 1.0 and if it is I assume there is a collection of versions I can iterate through, that's where my error shows up
Looking at the path of the queries in my logs they look the same on the 16th and on the 18th.
The path on the 16th where I get the collection of versions
_api/web/lists(guid'ef17ced5-440c-4dc9-8d44-c5c53ff1e9a7')/items?$select=Id%2cVersions%2c*&$expand=Versions&$filter=Id+eq+11&$top=1
And here is the path on the 18th when it has stopped working
_api/web/lists(guid'ef17ced5-440c-4dc9-8d44-c5c53ff1e9a7')/items?$select=Id%2cVersions%2c*&$expand=Versions&$filter=Id+eq+11&$top=1
Category
Describe the bug
When trying to get all the versions on a list item I only get the latest version, not all the versions of the list item. I get the list item by id with query properties li => li.All, li => li.Versions to get all properties and versions.
Steps to reproduce
I get the list and list item and load versions.
x only includes 1 version, which is the newest version of the item. All the older versions are missing. Here is the output from x:
Expected behavior
I expect all the versions of the list item (see versions above) to be returned when loading listitem.Versions.AsRequested(); like the documentation says. https://pnp.github.io/pnpcore/using-the-sdk/listitems-intro.html#getting-list-item-versions
Environment details (development & target environment)
Additional context
I'm pretty sure this is a new issue. I think this has worked before but I'm going through logs in my application to see if I can see if it was working before and when it stopped working.
Thanks for your contribution! Sharing is caring.