Reputation: 1
I have a category list in SharePoint which have all categories in my list:
While it is sub-category list which has all sub-categories
And I also have third list which have items and the respective category and sub-category IDs:
I have to develop a webpart in SPFx which renders all the categories and under the category it should have 3 columns for sub-category and under each sub-category it renders the items related to that category.
UI of Web Part that I have to build
How to build this webpart? I am using SPFX with React and PnP SP for APIs kind of things.
I am not sure how to get data from all of the list and do the joins to get data from a different lists.
Upvotes: 0
Views: 690
Reputation: 107
Since the technology I specialize in is the Microsoft Graph API, so, the solution I can provide is to use the below endpoints of the Microsoft Graph, which supports for getting data from SharePoint lists, creating new lists or columns and creating new items or updating items in lists.
Here are some documentations for your reference:
https://learn.microsoft.com/en-us/graph/api/resources/sharepoint?view=graph-rest-1.0
https://learn.microsoft.com/en-us/graph/api/list-get?view=graph-rest-1.0&tabs=http
GET /sites/{site-id}/lists/{list-id}
GET /sites/{site-id}/lists/{list-id}/items
POST /sites/{site-id}/lists/{list-id}/items
PATCH /sites/{site-id}/lists/{list-id}/items/{item-id}
POST /sites/{site-id}/lists
Create a columnDefinition in a list
POST /sites/{site-id}/lists/{list-id}/columns
To use the graph Api, you first need to authenticate and acquire a token, which contains the permissions required to use a specific endpoint, and you need to register your app in AD partial and add permissions to it.
You can refer to the official documentation to follow the complete guidance.
Hope this helps. If you need any more help, please feel free to comment below. Best Wishes.
Upvotes: 0