Sharepoint - 如何仅返回最新的公告
使用 WSS 3.0,我最近想出了如何聚合来自多个 Sharepoint 子站点的公告,以便它们可以显示在顶级站点上(请参阅:Sharepoint - 如何将子网站的公告聚合到主网站)。
我现在需要做的是仅显示每个子站点的最新公告 - 就像 SQL 中的 SELECT TOP 1 FROM 一样。 因此,尽管每个子站点可能有多个公告,但我只想显示每个子站点中最新的一个。
我认为这将非常容易 - 这似乎是一件显而易见的事情,但我在我拥有的文档中找不到任何参考。
因此,如果有人知道如何做到这一点,或者可以为我指明正确的方向,那就太好了。
谢谢。
Using WSS 3.0 I have recently figured out how to aggregate the announcements from several Sharepoint sub-site so that they can be displayed on the top-level site (See: Sharepoint - How to agregate Announcements from sub-sites onto main site).
What I need to do now is to display just the most recent announcement from each of the sub-sites - rather like the SELECT TOP 1 FROM that you might have in SQL. So although each of the sub-site might have several Announcements, I only want to display the most recent one from each of them.
I assumed that this was going to be dead easy - it seems to an obvious sort of thing to want to do, but I just can't find any reference in the docs that I have.
So if anyone knows how to do this, or can point me in the right direction, that would be great.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有自定义代码(无论是 XSL 还是 C#),这是不可能的。 使用 SPSiteDataQuery (COntextQueryWebPart) 和 CAML 时,您可以按 WebId 进行分组,但不能在分组内进行顶部操作。 您可以尝试单独执行每个站点,并将 CAML 查询的 RowLimit 设置为 1,将 OrderBy 设置为 Created,使用 ASCENDING='False'
因此查询将如下所示:
This is not possible without custom code (be it XSL or C#). You can do a grouping by WebId when using SPSiteDataQuery (COntextQueryWebPart) and CAML, but you cannot do a top INSIDE the grouping. YOu could try to do each site seperately and set the CAML query's RowLimit to 1 and OrderBy to Created, using ASCENDING='False'
SO the query would look something like this: