Help With SharePoint Online REST API - HTTP Request Authentication

Hi All,
I am fairly new to RPA development and a complete novice at APIs. However, what I need to do is fairly simple and I am hoping you guys will be able to help me.

I am trying to create a robot for an internal process. I need to get list items (values in a particular column) from a SharePoint online list.

I tried the REST API URL directly in the browser and it works when I am signed into SP Online.
I am trying to do the same now with the UiPath HTTP request activity.

However, I am having trouble setting up the request builder.
I don’t know how to setup the authentication for an API.

The request URL is as below:


This URL works when I directly paste it the browser when I am signed in on SP Online.

However, when I try it with UiPath HTTP Request Activity, I get the following error:

<m:error xmlns:m="">
  <m:code>-2147024891, System.UnauthorizedAccessException</m:code>
  <m:message xml:lang="en-US">Attempted to perform an unauthorized operation.</m:message>

Can someone please help me with setting up one of the Authentication methods and the query.
I tried the Simple HTTP authentication with my username and password but got the same error.

So now it looks like I either need to use the OAuth1 or the OAuth2 authentication method. And I how no idea on how to do either. Some guidance on how to setup the authentication for either of the 2 methods would be really appreciated.

Best Regards,
Achal Desai


Instead of trying with REST API, why don’t you try Sharepoint Activities?

Install the above package from Manage Package and you can use different activities

Else for REST API

Check as below

“http:///_api/web/lists” - ENDPoint
endpointRequest.Method = “GET”; → Select Get
endpointRequest.Accept = “application/json;odata=verbose”;
“Authorization” = "Bearer " + accessToken);

Bearer Should be added before the access Token

Hope this may help you


Thanks @Srini84, I will try the activity and let you know the results.
But out of curiosity and future use, how do I get the Bearer and Access Token?


Bearer is just a string no need of getting from anywhere

Acces token can be get from the sharepoint app

Check above for getting the access token

So you need to provide as below

Header Name - “Authorization” = “Bearer” +" "+ YourAccessToken

Hope this may help you


Thanks @Srini84, but looks like I will not be able to get the access token.
I do not have admin rights.
But thanks for the help anyway.


If access token is not provided then you can proceed with REST API
because Sharepoint is not a public site

Even to use the activities you need the login password correctly with some rights

If this answers your questions, Close this thread by clicking on Mark As Solution


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.