简体   繁体   中英

How can I read a SharePoint list from JavaScript?

I need to read and create a SharePoint list from a JavaScript file on my localhost. How can I do this? I think I need to get credentials via oAuth but I'm not really sure

I know there is a library called http://sympmarc.github.io/SPServices but I'm not sure if I can read outside sharepoint portal.

I never used this library sympmarc/SPServices , but it seems not to restrict for use outside sharepoint portal after I researched it slightly.

Meanwhile, I think you can refer to the offical document Working with lists and list items with REST to directly use the SharePoint REST service to read a list.

And for how to get credentials via OAuth, there is a similar SO thread How can I get an oauth access token in sharepoint 2013? which you can refer to. Then, you will know the correct way is to obtain an access token for REST API calling, which be introduced in the section Reading data with the SharePoint REST interface of the document Complete basic operations using SharePoint REST endpoints , as below.

For more information about how you can obtain an access token, see Context Token OAuth flow for SharePoint Add-ins and Authorization Code OAuth flow for SharePoint Add-ins . `

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM