TransWikia.com

Reading configuration at runtime

SharePoint Asked by Milind on October 25, 2021

I have created "Search Result Source" in my development & production environment Using that in search REST API with source GUID. Now thing is that source GUID of development & production environment are different.

So I am looking for way to define guid in config file like web.confing in C# and reading in SPFx.

This will make easier to read development and production configuration plus it will help to maintain SPFx development

Please note that I am using reactjs as framework.

One Answer

You can create a .ts file with necessary information and import it anywhere in your web-part project.

Reference: AppSettings in your SPFx solutions

OR

You can create a property pane field to pass the Result Source GUID and use it in your web-part.

Reference: Make your SharePoint client-side web part configurable

Answered by Ganesh Sanap on October 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP