We can fetch data from SharePoint in various ways - CSOM (client side object model), JSOM (JavaScript Object Model), Server Object Model, Graph API, Rest API.
REST API has been one of the most popular choice for developers. Major advantage is that REST is faster, universally accepted standard, platform independent.
With SharePoint, you can quickly test the REST call in your browser (try url from address bar) to check the returned response before actually using it.
REST API to get all items from SharePoint List/Document Library
Use GetByTitle('[List Name]')https://[Tenant].sharepoint.com/sites/[SiteName]/_api/web/lists/GetByTitle('[ListName]')/items
This gets all list items from selected list[Tenant] = name of your tenant
[SiteName] = Name of Site Collection / Sub site
[ListName] = Name of your SharePoint list
Get only selected column
Append ?$select=[Column Name]https://[Tenant].sharepoint.com/sites/[SiteName]/_api/web/lists/GetByTitle('[ListName]')/items
?$select=Title
This gets Title field value of all list items from selected listGet multiple columns
Append ?$select=[Column Name 1,Column Name 2]https://[Tenant].sharepoint.com/sites/[SiteName]/_api/web/lists/GetByTitle('[ListName]')/items
?$select=Title,Date
This gets Title and Date field value of all list items from selected listYou can further filter, order and sort columns in the REST query.
This link can be used with an AJAX function in your HTML and JQuery/JavaScript code to process and display the results ==> data.d.
The REST call will work with any language - .Net, JAVA, PHP, HTML, etc.
More Posts related to SharePoint,
- SharePoint error - An exception occurred when trying to issue security token: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms..
- PowerShell iterate and get all SharePoint sites and sub sites
- SharePoint Online: Editing session has ended Message
- How to Share Microsoft SharePoint Site with Users or Groups
- How to delete SharePoint Online List Item using REST API
- SharePoint List excel import - This table exceeds the maximum number of supported rows
- How to disable SharePoint subsite creation option for owners
- SharePoint 2010 August 2015 Update KB3055049 - Duplicate Document ID issue bug fixed
- SharePoint Server 2016 Preview installation error - This Product Key isn't a valid Microsoft Office 2016 Product Key. Check that you've entered it correctly.
- How to upload file programmatically to SharePoint Document Library using Server Object Model C# .Net
- Access URL for SharePoint Tenant Admin Center (Online Office 365)
- Error when deleting SharePoint Online folder or file
- How to extend retiring SharePoint 2010 Workflows and continue with Office 365
- How to generate client id and secret to register SharePoint App with OAuth
- How to delete SharePoint List Item programmatically using C#.Net
- How to retrieve all SharePoint Online List Items using Rest API
- [Solved] SharePoint Search Internal server error exception
- Create SharePoint Site Collection using PowerShell New-SPSite
- Fix SharePoint PowerShell error - The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program
- How to enable anonymous public access for SharePoint Online site collection, file, folder without login ?
- SharePoint Server 2016 installation System Hardware requirements
- How to create SharePoint Online List Item using REST API
- Changed AD user display name showing old name in SharePoint
- Recommended size and resolution for SharePoint Online Site logo
- Microsoft 365: How to Turn Off Delve in SharePoint Online for All Users
More Posts:
- Disable Control Scroll Zoom-in and Zoom-out in Notepad++ - NotepadPlusPlus
- Background task activation is spurious error - Windows 10, Office 2016, Office 365 - HowTos
- Fix: ModuleNotFoundError: No module named azure-core - Azure
- What is HTTP 500 Internal Server Error Code on web browsers - HowTos
- How to install curl on Alpine Linux - Linux
- Add X days from today in Command Line - HowTos
- Fix: >>> pip install - SyntaxError: invalid syntax - PIP
- Java TLSv1.3 protocol code example using SSLSocket - Java