0

I have a REST call (Web Activity) in the Azure data factory that returns the JSON list. Now, I need to Post that List to the share point site.

So when I go this URL in the browser

https://organization.sharepoint.com/sites/PartA/PartB/Lists/Jobs/AllItems.aspx

I see a table of items. My Json list is to be posted to this "Jobs" list to add to it.

First, I am thinking of having the Web Activity that would POST data, to the share point. So, I will register an app to get Access Token.
I have few options, and do not know whhat is the correct one.

  1. When I go to https://organization.sharepoint.com/sites/PartA/PartB/_layouts/appregnew.aspx to register the New app. And here is the problem - it says that I have no access.

  2. I go to https://organization.sharepoint.com/_layouts/appregnew.aspx (no sites/PartA/PartB url parts, and here I can register new Application (app1) with no issues.
    So, I do that, and record client_Id and client_secret.

  3. I can also register an Application in the Azure Active Directory. (app2) So, now, I registered 2 applications. {app1, and app2}

Running in the PostMan, I can get the Bearer token

https://accounts.accesscontrol.windows.net/<tenant_ID>/tokens/oauth/2

with body parameters
client_id = <client_id_app1 or app2>/@<temamt_ID>
client_secret = <client_secret from app1 or app2>
grant_type = client_credentials
resource = 00000003-0000-0ff1-ce00- 
000000000000/organization.sharepoint.com.sharepoint.com@<tenant_ID>

Running such Postman GET request, I get Bearer token for both cases (app1 and app2) I know that I only need one of them

However, when I then do a Get request (for example) to get the list of jobs from SharePoint

https://organization.sharepoint.com/sites/PartA/PartB/_api/Web/Lists
(providing the Bearer token obtained - either of the 2)

I get an error

-2147024891, System.UnauthorizedAccessExceptionAttempted to perform an unauthorized operation.

I do understand what the error means, I just do not know at what spot in my logic I have to fix something.

Thanks for the help

Dmitriy Ryabin
  • 363
  • 3
  • 16

0 Answers0