Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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/0683p000009MAB6.png:/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..

Labels (2)
14 Replies
Anonymous
Not applicable
Author

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

 

Anonymous
Not applicable
Author

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?

tanjaj
Contributor III
Contributor III

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


upload.JPG
download.JPG
nganapathy
Contributor
Contributor

Hi Tanjaj,

I followed the steps you mentioned. I am not getting any error. However I am not able to download the file. A file is downloaded with some sort of HTML content, I uploaded different types of files (.csv, xlsx). But I am not able to download any of the files using Talend. Could you please help me with this?

 

Thanks

Nandini 

 

tanjaj
Contributor III
Contributor III

Hi,

You can't download file at all or you can download some file but you see HTML content?

Do you have this $value at the end of GET url?

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

And can you post screenshots of component settings?

 

Br,

Tanja

nganapathy
Contributor
Contributor

Hi Tanjaj,

 

I have attached a screenshot of my SharePoint site page and talend component page. Could you please tell me how to download the file under the title car-sales.

I initially uploaded the file in Share Documents (under Documents section, the name is same as list). The talend screenshot is for the DHL/car_sales file. 

 

I really appreciate your response.

 

Thank you

Nandini

 

 


sharepoint_screenshot.PNG
Component_Screenshot.PNG
sidd
Contributor II
Contributor II

I am getting below error. do you have any idea on this.

 

 

[statistics] connecting to socket on port 3804

[statistics] connected

403 Forbidden

{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

[ERROR] 09:10:58 tbbi_firm_etl.copy_of_tbc_pp_load_measure_dim_0_1.Copy_of_TBC_PP_LOAD_MEASURE_DIM- tHttpRequest_2 - 403 Forbidden

{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

[statistics] disconnected

AIjel
Contributor
Contributor

Hi xdshi 

the link of the article you mentioned is broken

please share the good link

thanks

Anonymous
Not applicable
Author