From 0af9f951068099817dae48da11358b3fdedb2aad Mon Sep 17 00:00:00 2001 From: Patrick Rodgers Date: Tue, 4 Feb 2025 10:23:32 -0500 Subject: [PATCH] updating lists docs getChanges example to use new util method --- docs/sp/lists.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/sp/lists.md b/docs/sp/lists.md index 4eb0484c7..5817eb77a 100644 --- a/docs/sp/lists.md +++ b/docs/sp/lists.md @@ -237,12 +237,10 @@ console.log(r); To get changes from a specific time range you can use the ChangeTokenStart or a combination of ChangeTokenStart and ChangeTokenEnd. ```TypeScript -import { IChangeQuery } from "@pnp/sp"; +import { IChangeQuery, createChangeToken } from "@pnp/sp"; //Resource is the list Id (as Guid) -const resource = list.Id; -const changeStart = new Date("2022-02-22").getTime(); -const changeTokenStart = `1;3;${resource};${changeStart};-1`; +const changeTokenStart = createChangeToken("list", list.Id, new Date("2022-02-22")); // build the changeQuery object, here we look at changes regarding Add and Update for Items. const changeQuery: IChangeQuery = { @@ -250,7 +248,7 @@ const changeQuery: IChangeQuery = { Update: true, Item: true, ChangeTokenEnd: null, - ChangeTokenStart: { StringValue: changeTokenStart }, + ChangeTokenStart: changeTokenStart, }; // get list changes