内容查询 Web 部件和已删除的事件发生次数
我有一个内容查询 Web 部件,在我们的 Intranet 主页上显示了今天的 3 个事件。但是,当用户从重复系列中删除事件时,SP 会将该事件的标题更改为“已删除:[原始标题]”。我的内容查询 Web 部件仍然显示这些内容,但我没有找到将它们过滤掉的方法。
对于我的列表视图,我使用以下字段和该字段中的公式来解决它。 =IF(ISNUMBER(FIND("已删除:",标题)),"是","否")。
但是,我在 CQWP 筛选器下拉列表中无法使用该字段。
如何防止这些已删除的事件显示在 CQWP 中?
更新:顺便说一句,这是一个发布页面。
I have a content query web part showing 3 events for todays date on our Intranet homepage. However, when a user deletes an event from a recurring series, SP changes the title of that event to "Deleted: [original title]". My content query web part still shows these and I don't see a way to filter them out.
For my list views I get around it with a field and a formula in that field of the following.
=IF(ISNUMBER(FIND("Deleted:",Title)),"Yes","No").
However, that field isn't available to me within the CQWP filter drop-down.
how does one prevent these deleted occurrences from showing in a CQWP?
UPDATE: This is a publishing page BTW.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然您可以通过 XSLT 执行过滤,但最好在 CAML 查询本身中执行此操作。本文来自 Microsoft,如何:使用自定义属性自定义内容查询 Web 部件,显示了如何构造 CAMLWhere 子句(并且可以修改)。祝你好运!
While you can perform the filter via XSLT, it may be preferable to do so in the CAML query itself. This article from Microsoft, How to: Customize the Content Query Web Part by using Custom Properties, shows how the CAML Where clause is constructed (and may be modified). Good luck!
您以前尝试过 DataFormWebPart (DFWP) 吗?它基本上是最基本的数据绑定 Web 部件,但奇怪的是也是最可定制的。
要尝试一下,请打开 SharePoint 设计器并创建一个虚拟的 aspx 页面来处理/使用。然后打开数据源窗格并找到您要使用的列表。然后单击该列表并选择“查看数据”。将适当的字段拖到 aspx 页面上。您现在有一个(非常)基本的网格来显示您的数据。
但最酷的是,所有布局都是 xsl 驱动的,因此完全可定制。您甚至可以通过切换到源视图并将 xs,l 剪切并粘贴到单独的 xsl 文件中来使 xsl 可重用。要使用此文件而不是内联 xsl,请在移动内联 xsl 后,将 DFWP 属性 xsl(包含内联 xsl)从 更改为
唯一
剩下的问题是 DFWP 的数据源现在绑定单个列表。要跨网站集进行汇总(如果您想包含多个事件列表),您需要更改 DFWP 的 SPDataSource 的选择查询和数据源模式。解释了如何执行此操作 此处。
现在解决您的实际问题:(在我公然插入未被充分重视的 DFWP 后:-D)DFWP 的 SPDataSource 基本上使用 SPQuery 或 SPSiteDataQuery(取决于数据源模式)来检索数据,并且你可以做更多明智的过滤。可以在 CAML 查询本身中,也可以使用如下所示的方法过滤掉不需要的行:
Have you tried the DataFormWebPart (DFWP) before? It is basically the most basic of databound webparts, but strangely the most customizable as well.
To try it out, open SharePoint designer and create a dummy aspx page to work on / play around with. Then open the datasources pane and find the list you want to use. then click on that list and select "view data". Drag the appropriate fields onto the aspx page. You now have a (very) basic grid displaying your data.
The cool thing is though, all layout is xsl driven, so completely customizable. You can even make the xsl reusable by switching to source view and cut and paste the xs,l into a separate xsl file. To then use this file instead of the inline xsl, after moving the inline xsl, change the DFWP property xsl (that contained the inline xsl) from
to
The only remaining problem is that the DFWP's datasource is now bound a single list. To do roll-ups cross site collection (if you have say multiple event lists you want to include), you need to change the DFWP's SPDataSource's select query and datasourcemode. How to do that is explained here.
Now to address your actual question: (after my blatant plug of the underappreciated DFWP :-D) The DFWP's SPDataSource basically uses either an SPQuery or an SPSiteDataQuery (depending on the datasourcemode) to retrieve the data, and you can do way more filtering wise. Either in the CAML query itself or by just filter out the unneeded rows using something like the following: