question

EtienneViljoen-2228 avatar image
1 Vote"
EtienneViljoen-2228 asked Richard3004-8305 published

Copy File from SharePoint not working

Hi @KranthiPakala-MSFT ,

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 this error:

{
"errorCode": "2200",
"message": "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: (403) Forbidden.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (403) Forbidden.,Source=System,'",
"failureType": "UserError",
"target": "Copy Files_copy1",
"details": []
}

I have set up the prerequisites and configured the pipeline as described. The GetBearerToken succeeds and passes a token to the Copy Data activity. Any ideas what might be the issue.

(I have created another Activity using the SharePoint Online List and the same credentials I am trying to use to copy the files, to download a list of files and this works no problem)

office-sharepoint-onlineazure-data-factory
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.

EtienneViljoen-2228 avatar image
3 Votes"
EtienneViljoen-2228 answered KranthiPakala-MSFT commented

I found this article http://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/ which helped me work through it step by step.

This helped me to realize that I had given the app permission on a specific site collection (https://tenantname.sharepoint.com/teams/teamname) but when I tried to call the API, I sent the request to the top level (https://tenantname.sharepoint.com/_api/web/GetFileByServerRelativeUrl('[relative-path-to-file]')/$value) instead of the specific site I was working on (https://tenantname.sharepoint.com/teams/teamname/_api/web/GetFileByServerRelativeUrl('[relative-path-to-file]')/$value)

Once this was corrected the problem was solved

· 1
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.

Hi @EtienneViljoen-2228,

Welcome to Microsoft Q&A forum and glad to know your issue was resolved.
Appreciate much for sharing your findings in detail, as it would be helpful for other community members reading this thread.

Please feel free to click "Accept Answer", so that users with similar issue can find this thread quickly.

Thank you & stay safe. :)

0 Votes 0 ·
ranjitkurian-6670 avatar image
0 Votes"
ranjitkurian-6670 answered ranjitkurian-6670 commented

Hi,

Could you please help me to know how to get the Teams/Team Name details from sharepoint, even i am facing the same Sink error

This is how my sharepoint path looks for me : https://{site url}/My%20Folder%20Name

Tried with below two links and it didnt work:

https://{site url}/_api/web/GetFileByServerRelativeUrl('/My Folder Name/My File Name.csv)/$value

https://{site url}/_api/web/GetFolderByServerRelativeUrl('/My Folder Name')/Files('My File Name.csv')/$value


Amened as per your above solution, but not sure how to get teams/teamname details.

https://{site url}/teams/teamname/_api/web/GetFolderByServerRelativeUrl(''/My Folder Name')/Files('My File Name.csv')/$value

Please advise...


· 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.

In my case the issue related to using a subsite. When you set up the security using

https://[your_site_url]/_layouts/15/appinv.aspx

You must use the same [your_site_url] when trying to get the file using

https://[your_site_url]/_api/web/GetFileByServerRelativeUrl('[relative-path-to-file]')/$value

1 Vote 1 ·

Thank you...

Along with folder name, I have given the complete path and its working fine for me...

0 Votes 0 ·
TaariqToffar-3094 avatar image
0 Votes"
TaariqToffar-3094 answered Richard3004-8305 published

Hi,

Could you assist I'm getting the below error 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,'

81602-image.png


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

81545-image.png



image.png (36.9 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.

Hi, I was able to resolve the issues the others had with the Forbidden(403) error.

Now I get the same error you had here. Were you able to resolve it and if so, how?

0 Votes 0 ·

Hi, I was able to resolve the issues the others had with the Forbidden(403) error.

Now I get the same error you had here. Were you able to resolve it and if so, how?

0 Votes 0 ·
anveshKumar-2353 avatar image
0 Votes"
anveshKumar-2353 answered san-7803 commented

Copy File from SharePoint not working.

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 this error:

Failed to import source schema. Failed to read data from http server.
Check the error from http server:The remote server returned an error: (403) Forbidden.
The remote server returned an error: (403) Forbidden.

I have set up the prerequisites and configured the pipeline as described. The GetBearerToken succeeds and passes a token to the Copy Data activity.

• Created a linked service to connect to SharePoint file path, connection was successful.
• Created a web activity and connected with copy activity taking http as source(csv file),
• when I try to import the schema from share point csv file it gives me below error.

Admin has registered app in sharepoint at site level but when he tries to give the permission at subsite level it gives internal service error.

We gave permission at site level in share point for eg( https://contoso.sharepoint.com) , when we try to give the permission at subsite level where the file resides it gives me internal server error


Appreciate your help on this.

Thanks



· 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.

Have you had any luck with this? Im having a very similar problem

0 Votes 0 ·
anveshKumar-2353 avatar image anveshKumar-2353 AlessioMartello-1600 ·

No luck yet.

0 Votes 0 ·

Como van? Pudieron resolver? estoy teniendo el mismo error

0 Votes 0 ·
Show more comments