AJAX + OData + Sharepoint 2010 的 ListData.svc、JSON-P 或 JSON 的基本身份验证xdr
我正在寻找一种方法:
执行跨域纯 JSON 请求 a-la YUI IO (http://developer.yahoo.com/yui/3/examples/io/io-xdr.html(使用基本身份验证))
或者
让 Sharepoint 2010 的 ListData.svc 支持 JSON -P (例如 /_vti_bin/listdata.svc/?$format=json&$callback=loaded),这样我就可以使用 jQuery.ajax 发出基本的身份验证请求。
只是为了澄清,我不确定上面的雅虎示例如何支持基本身份验证(jQuery 是一个简单的问题)。其次,Sharepoint 2010 在尝试 JSON-P 时抛出的错误是:
查询参数“$format”以系统保留的“$”字符开头,但无法识别。
我知道我们可以通过 http://code.msdn.microsoft.com/ 改造标准 WCF 数据服务DataServicesJSONP 但我不确定 Sharepoint。
我确信有些人可以想象这将非常有用。有谁知道这是如何运作的?
I am looking for a way to either:
Do a cross domain plain JSON request a-la YUI IO (http://developer.yahoo.com/yui/3/examples/io/io-xdr.html with Basic Authentication)
or alternatively,
Have Sharepoint 2010's ListData.svc support JSON-P (e.g. /_vti_bin/listdata.svc/?$format=json&$callback=loaded) so I can use jQuery.ajax to make a Basic Authenticated request.
Just to clarify, I'm not sure how the Yahoo example above could support basic authentication (jQuery is a simple mattery). Secondly, the error Sharepoint 2010 throws when attempting JSON-P is:
The query parameter '$format' begins with a system-reserved '$' character but is not recognized.
I know we can retro-fit standard WCF Data Services via http://code.msdn.microsoft.com/DataServicesJSONP but I'm not sure about Sharepoint.
As I am sure some can imagine this would be incredibly useful. Does anyone have an idea of how this could work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,我们最终使用 System.Net.WebClient 通过 .cshtml 文件访问 OData 服务。该应用程序与 Sharepoint 服务器位于同一云中,因此性能完全可以接受。
In this situation we ended up accessing the OData service via our .cshtml files using System.Net.WebClient. The application was in the same cloud as the Sharepoint server, so the performance was quite acceptable.