How to set URL of workbench and get the list item by ID?

New Contributor

I am a newbie to SharePoint development. I am using PnP JS library to retrieve the list item for a specific ID. 

 

// get a specific item by id(LINK to open this)
const item: any = await sp.web.lists.getByTitle("My List").items.getById(1).get();
console.log(item);

 My requirement is to get data for specific ID (Like- https://abc.sharepoint.com/sites/SiteNAME/_layouts/15/workbench.aspx?Param=46)and that ID should be work as a parameter.

 

so, the number in link 46 is List Item ID. How would I set that Param inside the spfx webpart?

 

Thank you!

 

 

0 Replies