2

I am trying to do the following:

I have a Wordpress site where I have created a form. On submit event I want to send the data to my Sharepoint Online list. The problem I am facing is the fact that the solution needs to be build entirely with JavaScript and/or jQuery.

I have seen multiple examples of people doing it but all of them somehow are having client context or _spPageContextInfo available. That is not the case with me.

My question is: Is there a way just send the data to the list using simple POST request?

1 Answer 1

1

OutSide of SharePoint Online Site, it's necessary to get the access token for authentication purpose.

A solution is to register a SharePoint App and get the access token with this request:

enter image description here

enter image description here

Then use the access token in the request to handle data:

enter image description here

Here is a detailed blog for reference:

Accessing SharePoint Data using Postman (SharePoint REST API)

Postman is a test purpose, you can convert the request above into Jquery ajax for coding.

3
  • I see! Just a quick question: Is this token will ever expire? Commented Jan 22, 2021 at 8:57
  • Yes, the access token will expire in 12 hours. please check the details in this blog: spshell.blogspot.com/2015/03/sharepoint-online-o365-oauth.html Commented Jan 22, 2021 at 9:16
  • Thank you very much for the suggestion it helped me figure out my problem! Commented Jan 22, 2021 at 14:05

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.