sthambi
sthambi

Reputation: 257

Copy Sharepoint online csv to datalake using Azure Data Factory

I am trying to copy CSV file from Sharepoint online to Data lake using Data Factory. I followed the below documentation.

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

My pipeline looks below

enter image description here

I am getting errors in the copy data activity. My connection to Sharepoint is successful, and even I can download the CSV file using the base & relative URL.

Below is my error

Error code 2200

ErrorCode=HttpRequestFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Http request failed with client error, status code 403 Forbidden, please check your activity settings. If you configured a baseUrl that includes path, please make sure it ends with '/'.
Request URL: https://xxxx.sharepoint.com/sites/39421875/_api/web/GetFileByServerRelativeUrl('/sites/39421875/Shared%20Documents/Test.csv')/$value.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (403) Forbidden.,Source=System,'


enter image description here

My base URL: https://xxx.sharepoint.com/ Relative URL: sites/39421875/_api/web/GetFileByServerRelativeUrl('/sites/39421875/Shared Documents/Test.csv')/$value

Not sure why the above error is coming? I added "/" in the base URL.

I tried multiple times, and the same error is happening. Even I tried to give a complete URL in the base URL but with no success. I followed the documentation for the Additional Header.

Can anyone advise?

Upvotes: 1

Views: 2647

Answers (1)

Vamsi Bitra
Vamsi Bitra

Reputation: 2739

The above error is mainly because of Authorization Failure. Please make sure to check whether the below permissions are granted or not.

Go to Azure Active directory -> App registration and open app -> API permission -> Add this permissions.

Ref

And also please follow the below reference: It has detailed information about app permission on specific site collection and Authorization of SharePoint.

Reference:

DataFactory: Extract data from SharePoint Online by javiBI

Access SharePoint Online using Postman by Shantha Kumar

Upvotes: 0

Related Questions