0

I have a big application that uses the SP.ClientContext (JSOM).

I need to deploy it to one of these 2 options:

  1. SharePoint Web Part (https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part).
  2. A static web app on Azure.

The SharePoint Web Part has a context but neither of these has the correct SP.ClientContext variable.

How can I obtain the variable (or something similar)? I would like to avoid switching to the Graph client because of the number of requests that I'll have to refactor.

1 Answer 1

1

You can use JSOM within SharePoint framework (SPFx).

Here are the high level steps you need to perform:

  1. Register the SharePoint JSOM API as external scripts
  2. Install TypeScript typings for SharePoint JSOM
  3. Reference SharePoint JSOM scripts in your web part

Check below documentation for detailed steps:

Documentation: Connect to SharePoint using the JavaScript Object Model (JSOM)

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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