3

Is it possible to make SharePoint 2013 resources accessible via internet using REST API? Say I want to do CURD with a list from outside of SharePoint. How we can manage credentials for this situation? I've seen some sites (yammer) uses SSO by redirecting users to their company website and get credentials from there. Can we use the same approach with REST API for credentials? If yes, please explain how? (Just the credentials part)

2
  • There are possibilities for this, but first you need to consider: Will you use REST from C#? From console application or web application. Or from a browser, if so is using a SharePoint hosted app sufficient?
    – eirikb
    Commented Apr 24, 2014 at 6:53
  • Thanks for the quick response eirikb.. It could be used both Web application and SharePoint app. Let's say, I want to create a widget using REST, Javascript and JSON to access those lists. So, the widget cotains html and javascript, completely resides on a client side (Not server side). So that I can add it to non sharepoint site or a sharepoint site I want. I usually use visual Studio 2012 and C# for development.
    – anbuj
    Commented Apr 25, 2014 at 9:05

1 Answer 1

2

Assuming you have SharePoint on-premise and not 365.

Making a client-side only solution is easy if you use apps (SharePoint hosted), but you would have to deploy the app to SharePoint to be able to do cross-domain request.
Microsoft introduced two main solutions for querying cross-domain, SP.RequestExecutor.js for JSOM and /_api/SP.AppContextSite for REST, but as far as I know both of these require that you have an app hosted in a SharePoint environment. Here you don't need to think about authentication, as long as the app deploys that is handled for you.
If you have a stand-alone web site and you want client-side only communication with SharePoint I'm afraid that OOTB this is not possible. I can think of some solutions, as you can enable cross-domain, get access token for OAuth (might be 365 only) server-side or make your own service on SharePoint which supports CORS or JSONP - but this would be far from OOTB.

If you instead do the communication server-side everything will be much easier. I suggest you try making a Provider-hosted app, you will find this option in Visual Studio when creating apps for SharePoint. Then you set up High trust (S2S) which will let your app use CSOM to communiate with your on-premise SharePoint, authenticated as a user.

8
  • Of course I have Sharepoint Server 2013. I'll try REST (/_api/SP.AppContextSite). Still it requires Sharepoint hosted app. NOt an individual one. Anyway, I'm not looking for OOTB solutions, if you have any suggestions of how it can be done, please share. Thank you for the answer.
    – anbuj
    Commented Apr 28, 2014 at 4:57
  • @anbuj Did you find any solution to do this? I'm facing the same problem as I would like to use only the REST api to access data from lists but also need to query lists from different web applications.
    – André
    Commented May 5, 2014 at 18:58
  • Hi @André, what is your specific approach? I.e., what do you have and what are you trying to do?
    – eirikb
    Commented May 5, 2014 at 20:46
  • @André, I didn't find a solution which satisfies my requirement yet. It can be done with the method what eirikb mentioned, but my clients don't want to go with High trust (S2S). I'll post as an answer if I find a way. If you did find a way before me, please post here as an answer.
    – anbuj
    Commented May 6, 2014 at 4:42
  • @anbuj did you try using REST from C#? Here is an example of how you can authenticate: dotnet-rocks.com/2013/10/02/…
    – eirikb
    Commented May 6, 2014 at 5:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.