Using sharepoint rest api

Copper Contributor

Hello ,

I'm struggeling since 2 day to make a simple code that connects to Sharepoint ( online) and upload a ducument.

I'm always having "unauthorized" response.

I'm sharing with you the information of the trial I created for this pupose and if anyone can share a piece of code that connects and make a basic operation like retrieving all the lists I will very thankfull.


SharePoint site="

username : ""

password : "Operating0"


2 Replies
@Sami you need to provide additional context so that someone can help.

What type of application are you building and with which technologies?
For example, is it a console application with C#? Is it a provider hosted add-in? Is it a JavaScript application?

There are a ton of samples on GitHub under the PnP repositories and there's probably one there that matches your needs, but I can't help more until you provide additional context.
Also, if those are valid credentials, I would strongly recommend that you remove them from your post and update the password. You should never post credentials online because you never know what people may do with them.