Using sharepoint rest api

%3CLINGO-SUB%20id%3D%22lingo-sub-290003%22%20slang%3D%22en-US%22%3EUsing%20sharepoint%20rest%20api%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290003%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20%2C%3C%2FP%3E%3CP%3EI'm%20struggeling%20since%202%20day%20to%20make%20a%20simple%20code%20that%20connects%20to%20Sharepoint%20(%20online)%20and%20upload%20a%20ducument.%3C%2FP%3E%3CP%3EI'm%20always%20having%20%22unauthorized%22%20response.%3C%2FP%3E%3CP%3EI'm%20sharing%20with%20you%20the%20information%20of%20the%20trial%20I%20created%20for%20this%20pupose%20and%20if%20anyone%20can%20share%20a%20piece%20of%20code%20that%20connects%20and%20make%20a%20basic%20operation%20like%20retrieving%20all%20the%20lists%20I%20will%20very%20thankfull.%3C%2FP%3E%3CP%3E-%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%232b91af%22%20face%3D%22Consolas%22%20size%3D%222%22%3ESharePoint%20site%3C%2FFONT%3E%3CFONT%20face%3D%22Consolas%22%20size%3D%222%22%3E%3D%3C%2FFONT%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Consolas%22%20size%3D%222%22%3E%26nbsp%3B%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3E%3CA%20href%3D%22https%3A%2F%2Fsamimstest22.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsamimstest22.sharepoint.com%3C%2FA%3E%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3E%3CFONT%20color%3D%22%23333333%22%3Eusername%26nbsp%3B%3A%20%3C%2FFONT%3E%22admin%40samimstest22.onmicrosoft.com%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23a31515%22%20face%3D%22Consolas%22%20size%3D%222%22%3Epassword%20%3A%20%22Operating0%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290063%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20sharepoint%20rest%20api%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290063%22%20slang%3D%22en-US%22%3EAlso%2C%20if%20those%20are%20valid%20credentials%2C%20I%20would%20strongly%20recommend%20that%20you%20remove%20them%20from%20your%20post%20and%20update%20the%20password.%20You%20should%20never%20post%20credentials%20online%20because%20you%20never%20know%20what%20people%20may%20do%20with%20them.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290059%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20sharepoint%20rest%20api%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290059%22%20slang%3D%22en-US%22%3E%40Sami%20you%20need%20to%20provide%20additional%20context%20so%20that%20someone%20can%20help.%3CBR%20%2F%3E%3CBR%20%2F%3EWhat%20type%20of%20application%20are%20you%20building%20and%20with%20which%20technologies%3F%3CBR%20%2F%3EFor%20example%2C%20is%20it%20a%20console%20application%20with%20C%23%3F%20Is%20it%20a%20provider%20hosted%20add-in%3F%20Is%20it%20a%20JavaScript%20application%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThere%20are%20a%20ton%20of%20samples%20on%20GitHub%20under%20the%20PnP%20repositories%20and%20there's%20probably%20one%20there%20that%20matches%20your%20needs%2C%20but%20I%20can't%20help%20more%20until%20you%20provide%20additional%20context.%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

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=  https://samimstest22.sharepoint.com"

username : "admin@samimstest22.onmicrosoft.com"

password : "Operating0"

 

2 Replies
Highlighted
@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.
Highlighted
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.