mercredi 4 mars 2015

How to authenticate user in SharePoint Online using rest api

I have a website on SharePoint Online and a website on SharePoint On-premise. From my On-premise website i want to create a new list on my SharePoint Online site.

To authenticate I used the following codes:

var soapRequest =
'<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi=""
<Login xmlns="">

And then:

url: myUrl + "_vti_bin/authentication.asmx?op=Login",
type: "GET",
contentType: "text/xml",
dataType: "json",
data: soapRequest,
success: function (a) {
error: function (a) {

As result I get:

XMLHttpRequest cannot load https://myUrl/_vti_bin/authenti…in3!%22%3C/password%3E%3C/Login%3E%3C/soap12:Body%3E%3C/soap12:Envelope%3E. The request was redirected to 'https://myUrl/_layouts/15/error.aspx?ErrorText=Request%20format%20is%20unrecognized%2E', which is disallowed for cross-origin requests that require preflight.

What can I do to avoid the error?

Thank you very much.

0 commentaires:

Enregistrer un commentaire