Node-RED to sharepoint (Solved)

Hello Every one!
I am try to save data to sharepoint list, but gets this error. any solution or ideas
image
has any one done something like this.
thanks in advance

Hi @weky - I'm not sure anyone here can say anything more than the error message does - You do not have permission to perform this action or access this resource

Have you checked your credentials etc?

@knolleary
Hi thanks, but i have checked my credentials and permissions. every thing is good on that side.

Try googling sharepoint error code and the number...

@weky what connection method are you using (i.e. rss, odata or the soap api) and what authentication are you using?

I haven't used SharePoint with Node-Red in particular, but getting SharePoint authentication to work with out the Sharepoint client libraries can be tricky.

i was using basic auth but it was not working
image
but I have solved it by registering an app on SharePoint tenant. and then used app ID and secret to get access token. then sent access token in the header.

Nice work!

The SharePoint API doesn't support Basic Authentication by default (you can force it on Premise by hacking IIS, but I don't think there's anyway to make it work with SharePoint Online).

Correct, sorry I missed this so couldn't respond in time. SharePoint Online requires "modern authentication" generally OAuth.

I would be very interested in a working example (without the authentication details of course) since SharePoint Online is something we use a lot at work. Having a working example to update a list from Node-RED could be quite handy.

I have not checked this myself, but there is an api to ms online called ms graph. I just descovered there is a node called node-red-contrib-viseo-ms-graph that can use this api to i.e sharepoint (OAuth2 Authentication). I think you then can insert/read data from a sharepoint list (or any other ms online application)

Data is sent recived as JSON

Ola