SPQuery:Query 和 ViewXml 属性之间的区别?
SharePoint 开发人员您好!
我无法深入理解 SPQuery 对象中 Query 和 ViewXml 属性之间的区别。在msdn文档中,它是这样写的:
- 查询:获取或设置内部XML 在查询中使用。
- ViewXml :获取或设置定义 看法。
在我看来,ViewXml 适合过滤您想要检索的字段...我不确定。
那么有什么区别呢?在什么情况下我们应该选择第一个而不是第二个? SharePoint 如何处理这些查询.. 对我来说仍然是个谜,所以是否有人可以解释一下? 谢谢...
Hello SharePoint developpers !
I can't deeply understand the difference between Query and ViewXml properties in the SPQuery object. In the msdn documentation, it's written :
- Query : Gets or sets the inner XML
used in the query. - ViewXml : Gets or sets the XML schema that defines the
view.
it seems to me that ViewXml is appropriate to filter the fields you want to retrieve... I'm not sure.
So what's the difference ? in which situations should we choose the first over the second ?
How SharePoint is treating those queries ..
Mystery remains for me so if someone could throw some light on it ?
thank you...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ViewXml 完整地描述了查询。它可以包含 Query、ViewFields、RowLimit 元素等等。对于 SPQuery,您最好使用相应的属性(Query、ViewFields、RowLimit 等),ViewXml 将自动生成。您可以通过为 SPQuery 对象设置此属性来测试它,然后查看 ViewXml。如果您需要设置某些特定属性,则应该手动设置 ViewXml(但我记得它们都可以使用 SPQuery 属性进行设置)。
ViewXml completly describes query. It can contain Query, ViewFields, RowLimit elements and many more. For SPQuery you should better use corresponding properties (Query, ViewFields, RowLimit etc), and ViewXml will be generated automatically. You can test it by setting this properties for SPQuery object and then look to ViewXml. You should set ViewXml manually if you need to set some specific properties (but as I remember they all can be set using SPQuery properties).