question

TaariqToffar-3094 avatar image
0 Votes"
TaariqToffar-3094 asked PriyaranjanSahoo-1177 edited

Azure Data Factory: Copy a file from SharePoint to Blob

Hi,

I am trying this method (https://docs.microsoft.com/en-us/azure/data-factory/connector-sharepoint-online-list#copy-file-from-sharepoint-online) but I get the error below when trying to copy a excel file from SharePoint to Azure Blob:

Failure happened on 'Sink' side. ErrorCode=HttpFileFailedToRead,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Failed to read data from http server. Check the error from http server:The remote server returned an error: (400) Bad Request.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (400) Bad Request.,Source=System,'


81615-image.png


The registered app has full control on all sites on SharePoint:


81585-image.png


azure-data-factory
image.png (77.0 KiB)
image.png (38.0 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@taariqtoffar-3094 Thanks for using Microsoft Q&A !!

Have you granted SharePoint Online site permission to your registered application as mentioned in the prerequisites section of the documentation ?
You need to Open SharePoint Online site link e.g. https://[your_site_url]/_layouts/15/appinv.aspx , provide other necessary details. Then Create and Trust the application as shown in the below image -
81568-image.png

Please let me know if you still face any issues.

0 Votes 0 ·
image.png (43.1 KiB)

Hi @SaurabhSharma-msft

In my case I am using Anonymous as Authentication type as per the document but still getting the same error. Do you have any suggestions on it ?

Thanks
Priyaranjan

0 Votes 0 ·
NandanHegde-7720 avatar image
0 Votes"
NandanHegde-7720 answered

Hey @TaariqToffar-3094 ,
Can you please check whether IRM property is enabled in the sharepoint.
Because :
Even if an Azure AD application has FullControl permissions on SharePoint Online, you can't copy files from document libraries with IRM enabled.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TaariqToffar-3094 avatar image
0 Votes"
TaariqToffar-3094 answered PriyaranjanSahoo-1177 commented

IRM is disabled in SharePoint, so it's not that.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you check whether the Service principal has access on sharepoint.

To check, please hit the below URL with proper values:
https://<<>>.sharepoint.com/sites/<<sitenm>>/_layouts/15/appprincipals.aspx

0 Votes 0 ·

Yes it does have access as per below:

82209-image.png


0 Votes 0 ·
image.png (14.1 KiB)

@taariqtoffar-3094 How are you using the base url. Can you please try using the Base URL like below -
https://<<abc>>.sharepoint.com/_api/web/GetFileByServerRelativeUrl('/Shared Documents/Sample.xlsx')/$value

I have tried this and it worked fine for me with windows authentication -
87007-image.png

Thanks
Saurabh


0 Votes 0 ·
image.png (49.0 KiB)

Hi @taariqtoffar-3094,

are you still facing the same issue or it got resolved ? If yes what is the change you made ?

I am also facing the same issue

Thanks
Priyaranjan

0 Votes 0 ·