I am trying to retrieve data from a SharePoint List hosted in a different server/domain. We are still running SP 2010 but about to migrate to 2013. I am not sure if jQuery.SPServices and CORS are the way to go ahead. Any solution?
2 Answers
I think you should look into consuming web services. You can consume them using managed code (by adding a service reference ) or using javascript (ajax call). This is a pretty comphrensive discussion around consuming the authentication.asmx
towards authenticating request to sharepoint.
Authenticating user with javascript
The authentication.login
method retunrs a token that you need to add to all the subsequent request headers. Inputs to authentication.login
are login name
and password
.
Once you get the token, you can use either the rest api or lists.asmx
to fetch data. jast make sure you pass the token in the subsequent requests.
References :
Working with lists.asmx
SharePoint 2010 Rest API
Hello I would suggest CSOM approach where you need to create two separate client context for each SharePoint i.e. one for SP2010 and other for SP2013 and then you can access list data from SharePoint 2010.
All the best!!!