2

I want to get the content of a file from sharepoint list using java through rest api

Can anyone help me,I am a newbie to sharepoint

Thanks in advance

1 Answer 1

3

Sharepoint provides a REST API to access lists. Here is a sample end point to start with.

http://server/site/_api/lists/getbytitle('listname')

Here is more documentation: https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service

https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest

Edit: To download file use the following URL:

http://server/site/_api/SP.AppContextSite(@target)/web/GetFileByServerRelativeUrl('/sites/Test/Shared Documents/" + sourcefile.get_name() + "')/$value?@target='myhosturl'

Refer to https://social.msdn.microsoft.com/Forums/sharepoint/en-US/02bfbcdc-73c8-4fa5-8967-cfd903a0d72e/javascript-client-object-model-openbinary-method

http://www.techmikael.com/2013/07/how-to-copy-files-between-sites-using.html for more information.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks uday for your answer,but with the above link i am able to get the xml data(metadata) for the files in the lists,but I want the complete file content to store the files in my local system,how can i do it. Is there any way to get the url of a file in list using the api,so that when i hit that url i can download the file to my local system.
Updated the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.