Jul 16 2022 12:31 PM
Hi,
Not sure what is going wrong but let list= sp.web.lists.getByTitle("News") always throws 404 error.
Checking the log the Uri it tries to hit seems wrong https://Tenant.sharepoint.com/sites/Site-Dev/_layouts/15/_api/web/getList('News')/views/getByTitle('...
but if I remove _layouts/15 it works well on the browser and i am able to get the return on the browser.
Now how to get the code fixed then?
sp/pnp@2.12.0
Thanks
Aniruddha
Apr 21 2023 05:19 AM
Apr 22 2023 03:30 AM
@Parthiban_Balraj @anirudhaditya,
You have to supply web part context to PnP JS library while using it within SPFx. Check below threads for more information (Use which works for you based on version of PnP JS library you are using):
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs