Forum Discussion

nrvrvl's avatar
nrvrvl
Copper Contributor
Jun 24, 2020

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

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(https://pnp.github.io/pnpjs/sp/items/#get-all-items 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://cummins365.sharepoint.com/sites/GRP_CC16984/_layouts/15/workbench.aspx)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!

 

 

No RepliesBe the first to reply