Sharepoint file download using tFilefetch or tHttpRequest

Highlighted
Four Stars

Sharepoint file download using tFilefetch or tHttpRequest

I referred all the threads on community but could not really understand Why do I get 403 Forbidden error or HTTP 301 error while trying to download the file from SharePoint.

I need to clarify some things:

a) Which link in SharePoint to be used in tHttpRequest or tFileFetch, currently I need to download this file from sharepoint, so I am using link

https://xxxx.sharepoint.com/Smiley Tongue:/r/teams/ESPPSR/Shared%20Documents/ESP%20Project%20Documentation/Pxxxxx...

 

is this a correct type of link to be put in SharePoint?

 

b) I work on a virtual box so how do I provide my authentication details...should it be followed by domain or without domain?

 

Any help would be appreciated..

Highlighted
Moderator

Re: Sharepoint file download using tFilefetch or tHttpRequest

Hello,

Could you please let us know if this article helps?

https://community.talend.com/t5/Migration-Configuration-and/While-accessing-a-file-from-Sharepoint-t...

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Four Stars

Re: Sharepoint file download using tFilefetch or tHttpRequest

Hi All

 

I need to download one / multiple files from Share point Document Library using Talend Open Studio.

 

I have tried various components like tFileFetch and tHttpRequest however, both of them generate 403 forbidden error so haven't found a solution as yet.

 

I have also tried putting some headers however, still haven't managed to resolve the issue.

 

I have visited various threads however, haven't found any concrete solution to this one

 

Can you please share your experience if someone has done this or know the solution to this?

Highlighted
Five Stars

Re: Sharepoint file download using tFilefetch or tHttpRequest

Hi,

Here is how I succeeded to download and upload files from Sharepoint using Talend tHttpRequest component:

1. Get Sharepoint access token (here is really good tutorial how to do it https://global-sharepoint.com/sharepoint-online/in-4-steps-access-sharepoint-online-data-using-postm... )

2. After you test it in Postman go to Talend

3. Search for tHttpRequest component

4. Upload file:

- Choose POST method

- URL:

"https://{your-site}.sharepoint.com/sites/Customer/_api/web/getFolderByServerRelativeUrl('{name-of-document-library}')/Files/add(url='{name-of-file}',overwrite='true')"

- In Header put

key: "Autorization"  value:"Bearer<space>sharepoint-access-key"

key: "Accept"          value: "application/json;odata=verbose"

 

5. Download file:

- Choose GET method

-URL:

"https://{your-site}.sharepoint.com/sites/Customer/_api/web/getFolderByServerRelativeUrl('{name-of-document-library}')/Files('{file-to-download}')/$value"

- In Header put

key: "Autorization"  value:"Bearer<space>sharepoint-access-key"

key: "Accept"          value: "application/json;odata=verbose"

 For more info about API: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest

 

If you have forbidden error - check your access key; if key is ok, then something is wrong with url, check where is your file actually.

Enjoy

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog