Get\Set multiple list data form SP On-Premises site to SP online site Using SPFx webpart
-
08-02-2021 - |
문제
I have one SharePoint On-Premises site which is accessible outside of my server. I already have few lists & libraries created on that site which I am using.
I have one Office 365 SharePoint subscription where I am using some modern inbuilt as well as custom web-parts.
In one of my Web-part, I have a form & I want data from SP On-Premises lists (E.G. Countries, Cities, etc.) to bind into drop-down available in SPFx form. I also want to post (save) form data to SharePoint On-Premises list (e.g. Customer Information).
Kindly help me by providing detailed information about How can I perform my operations.
I am using only SPFx solution so Kindly provide me the solution for my SPFx solution only.
해결책
You can design an Azure function or self-hosting web service that will connect to SP On-prem and get or post data from/to a list. Use the web service in your SPFx web part. If you need to authorize a user making a call to the function, register an Azure AD App and enable authorization for your Function App as described here.
다른 팁
I have created one Web API to get/post data using SharePoint On-premises.
I have used EnableCors in ApiController to avoid CORS related cross domain error while accessing the Web API through SPFx webpart.
I have used simple Ajax call to get/post data by calling different functions & passing the parameters to my few functions.
I have hosted my Web API to local IIS & provided one end point URL so I can use same for further use.