0

I have published Web API from Visual Studio 2017 in Azure portal and I want to consume those data in SharePoint online.

I have created one SPFx project file from node js and opened in Visual Studio code, Now I want to call the Web API from SharePoint framework.

I am new here please post some link and comments. How is it possible?

0

You can use the AadHttpClient in SPFx. It's well documented here: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient-enterpriseapi

  • i went through above url and found they are using Azure function , I want to consume webapi data not azure function? can you please help to differentiate? whether can we use azure function api in webapi ? and how to use to consume webapi in framework – Chandan Sahani Feb 9 at 15:03
0

Use jQuery getscript method for calling external API in SharePoint environment. In your spfx webpart code, install jQuery - npm i jQuery and use the following code snippet to call your external API.

$.getScript("test.js")
  .done(( script, textStatus )=> {
    console.log( textStatus );
  })
  .fail(( jqxhr, settings, exception )=> {
    console.log("Triggered ajaxError handler.");
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.