Akhil
Akhil

Reputation: 401

how to get file content from sharepoint list using restapi in java

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

Upvotes: 2

Views: 8656

Answers (1)

uday
uday

Reputation: 359

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.

Upvotes: 3

Related Questions