How to fix Sharepoint ErrorCode=HttpRequestFailedWithUnauthorizedError, Unauthorized, usually this is caused by invalid credentials, while downloading data from sharepoint online to blob using ADF

Prashant Joshi 0 Reputation points
2023-10-12T08:10:39.31+00:00

Hi Everyone

Hope your doing good.

Iam facing an issue while downloading files from sharepoint online using ADF..

for this process I registred app in azure and then grant the application access to the sharepoint online site ..after this i created pipeline in azure using web activity connected parallel with copy data using sink HTTPS ..but as a result iam unable to download file from sharepoint ... the error was given by copy activity

ErrorCode=HttpRequestFailedWithUnauthorizedError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Http request failed with status code 401 Unauthorized, usually this is caused by invalid credentials, please check your activity settings.

Request URL: https://chiacon.sharepoint.com/sites/Powerautomate/_api/web/GetFileByServerRelativeUrl('/sites/Powerautomate/Shared Documents/Test/Test.csv')/$value.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (401) Unauthorized.,Source=System,'Screenshot 2023-10-12 134020

Screenshot 2023-10-12 133857.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
{count} votes

7 answers

Sort by: Most helpful
  1. Kumar, Arun 336 Reputation points
    2023-10-12T15:28:34.0133333+00:00

    The error shows 401 unauthorized, means you do not have access. Seems like your token (id and secret key) is not the one that is needed for this access. Do you have by any change registered the app multiple times in the sharepoint site?

    1 person found this answer helpful.

  2. QuantumCache 20,366 Reputation points Moderator
    2023-10-13T18:19:10.9533333+00:00

    Hello @Prashant Joshi

    You can try recreating the app and sharing the app permissions once again.

    The SharePoint List Online connector uses service principal authentication to connect to SharePoint.

    https://learn.microsoft.com/en-us/azure/data-factory/connector-sharepoint-online-list?tabs=data-factory#prerequisites

    You may refer to this similar thread which may help!

    https://learn.microsoft.com/en-us/answers/questions/1287724/sharepoint-online-list-access-through-adf

    If you still need help in this regard, please comment in the below section to connect with us offline!!!
    User's image

    1 person found this answer helpful.

  3. Prashant Joshi 0 Reputation points
    2023-10-14T15:36:22.4266667+00:00

    Hi SatishBoddu-MSFT Thanks for our valuable reply for this problem.. itried same process again but this is still showing same error?

    can you please connect with me in teams to short out the issue?

    0 comments No comments

  4. Jean Pierre Patric Cid Bustos 0 Reputation points
    2024-03-22T19:31:32.53+00:00

    @Prashant Jos I wanted to know if you were able to solve the problem. I am doing the same implementation and I have the same problem and I have not been able to solve it. Please help me.

    0 comments No comments

  5. Ben Moghaddam 0 Reputation points
    2024-10-29T21:04:12.54+00:00

    @Prashant Joshi I am encountering the same error. Could you please assist? ErrorCode=HttpRequestFailedWithUnauthorizedError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Http request failed with status code 401 Unauthorized, usually this is caused by invalid credentials, please check your activity settings.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (401) Unauthorized.,Source=System,'


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.