This code snippets use pnp.js file. Please go through the following link to understand the basics of PnP-core JS.
To retrieve the total count of items present in a List.
- <script type=”text/javascript” src=”/siteassets/scripts/pnp.js”></script>
- <script>
- $pnp.sp.web.lists.getByTitle("My List").get().then(function(result)
- {
- alert(result.ItemCount)
- });
- </script>
- <script type=”text/javascript” src=”/siteassets/scripts/pnp.js”></script>
- <script>
- $pnp.sp.web.lists.getByTitle("My List").get().then(function(result)
- { alert
- (result.LastItemDeletedDate)
- });
- </script>
- <script type=”text/javascript” src=”/siteassets/scripts/pnp.js”></script>
- <script>
- $pnp.sp.web.lists.getByTitle("My List").get().then(function(result)
- { alert
- (result.LastItemModifiedDate)
- });
- </script>
To retrieve the date when an item has been last deleted.
- <script type=”text/javascript” src=”/siteassets/scripts/pnp.js”></script>
- <script>
- $pnp.sp.web.lists.getByTitle("My List").get().then(function(result)
- { alert
- (result.LastItemDeletedDate)
- });
- </script>
