从 SharePoint Web 服务查询列表数据
是否有人曾使用 http:///_vti_bin/lists.asmx 服务中的 GetListItems() 方法成功编写代码以从 SharePoint 2007 列表(特别是 InfoPath 表单库)中提取数据(并且有幸讲述了这一点)? 它返回了我一生中见过的一些最差 XML(它甚至不是兼容的 XML)。 是否有一些简单的方法来解析 C# 中的数据,或者我是否需要手动解析它?
对此的任何帮助将不胜感激。
Has anybody ever successfully written code to extract data from a SharePoint 2007 list (specifically, an InfoPath form library) using the GetListItems() method in the http:///_vti_bin/lists.asmx service (and lived to tell about it)? It returns some of the worst XML I've seen in my life (it's not even compliant XML). Is there some easy way to parse the data in C# or am I going to need to parse through it manually?
Any help on this would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然,这不是最漂亮的做事方式,但这只是获取正确示例的问题。
我使用以下代码从获取列表查询中获取“内容”。
使用示例调用它
并没有做很多事情,但希望它能让您了解如何获取数据。
是的,我非常不喜欢 XPathQueries 的整个命名空间问题,但是你要做什么。
我只是对重写 SharePoint Web 服务不太感兴趣,特别是因为在我们的环境中进行测试和发布本身就值得花费数周的时间。 但有时,没有选择。 例如,如果您想要访问 SPWeb 的自定义属性包或使用特定站点模板和内容数据库(或 Web 服务中未实现的其他数百万个事物中的任何一个)创建 SiteCollection。 然而,对于简单的列表访问,网络服务似乎很好。
Sure it is not the prettiest way of doing things, but it simply a matter of getting the correct examples.
I have used the following code to get "stuff" out of a get lists query.
Calling it using
The example does not do a whole lot, but hopefully it gives you an idea of how to go about getting the data out.
Yes I intensly dislike the whole namespace issue with XPathQueries, but what are you gonna do.
I am just not that interested in re-writing the SharePoint web services, especially as testing and releasing in our environment is weeks worth of effort in and of itself. Sometimes though, there is no option. E.g. if you want to access the custom property bag of an SPWeb or create a SiteCollection using a specific Site Template and content database (or any of the other million things that are not implemented in the web services). However, for simple list access, the webservices seem fine.
InfoPath 无法处理列表 Web 服务中的 GetListItems 中的 XML。 对于 InfoPath 2007,您有两个选择:
InfoPath cannot handle the XML from GetListItems within the Lists web service. With InfoPath 2007 you have two options: