是否可以通过互联网使用REST API使SharePoint 2013资源进行可访问?假设我想用SharePoint外面的列表做凝乳。我们如何管理这种情况的凭据?我已经看到一些网站(Yammer)通过将用户重定向到公司网站并从那里获取凭据来使用SSO。我们可以使用与REST API相同的方法进行凭据吗?如果是,请解释如何?(只是凭据部分)

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
scroll top