Sharepoint: Not able to fetch data from particular list item of site content using React APP WEB-part

sunil 96 Reputation points
2020-07-22T17:12:16.87+00:00

I am trying to fetch data from one of the list item of the site content on my SP site.

13310-screen-shot-2020-07-22-at-23855-am.png

I have built a React Webpart here are the files and code

13278-screen-shot-2020-07-22-at-114937-am.png
13279-screen-shot-2020-07-22-at-114955-am.png
13280-screen-shot-2020-07-22-at-115014-am.png
I have followed the documentation.

https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/connect-to-sharepoint

I was able to fetch the complete site content list(Document library), but when I am trying to fetch particular list using getByTitle('EmployeeList'), it fails.

Please Advice.

Thanks & Regards,

Sunil

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,129 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Amos Wu-MSFT 4,051 Reputation points
    2020-07-23T06:19:18.177+00:00

    13591-ireactnewprops.txt13427-reactnew.txt13592-reactnewwebpart.txtYou could use pnp js to get list items.
    https://pnp.github.io/pnpjs/sp/items
    13329-r1.png
    13424-r2.png
    13370-r3.png

    Test Result:
    13359-ppp.png

    You could get the code in attachments.