Forum Discussion
Americo Perez
Jun 04, 2019Iron Contributor
How to populate the dropdown with list names
Hi,
I am trying to create a dropdown in the property panel of a webpart with SPFx and I found this tutorial:
Use cascading dropdowns in web part properties
The problem with the sample is that is is using static data and I would like to know how to fetch the list names dynamically.
How can I do that?
Best regards
Americo
1 Reply
Sort By
- Rahul SuryawanshiCopper ContributorHi @America
You can load all lists from current site or specific site collection by calling SharePoint REST API using SPHttpClient class of SPFx or you can use fluent APIs of @PnP which is great wrapper around SharePoint APIs.
You can more details about SPHtppClient class here
https://docs.microsoft.com/en-us/javascript/api/sp-http/sphttpclient?view=sp-typescript-latest